Unfortunately this is the way it is supposed to work. It wasn’t clear to me either, and caused me to headaches until I realized what was actually being returned.
I found the ONLY way I could actually get consistent results when both in the simulator AND one the device was to use a text file that specified the platform.
platform_kindle.txt
platform_android.txt
etc
then I make a “staging” area using a batch file to copy all of the necessary files from my working directory and when I do that I rename the platform_*.txt file I am building for to “platform.txt”.
This allows me to check if platform.txt exists, and if so to read in the string inside. Then I use that to base all of my platform specific logic.
BTW, this isn’t necessary for iOS devices since the documentation is correct regarding the values you get back for the iOS platform.
This allows me to load my project from a staging area and see it function as if it was on the device.
[lua]local platformPath = system.pathForFile( “platform.txt”, system.ResourceDirectory )
local platformFile = io.open( platformPath, “r” )
local platformString = “”
if platformFile then
platformString = platformFile:read( “*a” )
io.close( platformFile )
end
local nDroid = string.find( platformString, “android” )
if ( nDroid ) then
– set some android specific values here
end
local nKindle = string.find( platformString, “kindle” )
if ( nKindle ) then
– set some kindle specific values here
end[/lua]
Hope that helps.
[EDIT] One other advantage to having a staging area is that the Android platform can be VERY picky about having certain files in sub-folders. So you can have your main working area as organized as you like, then copy everything into a flat folder structure for building your Android builds. This will save you all sorts of heartache.
Ken [import]uid: 16734 topic_id: 19635 reply_id: 75927[/import]