I have a Lua code and it works fine on my simulator on Mac, but when i install the apk on Android (Android 4.1) the system.preference code and the os.time() function doesn’t work, anyone knows what is happen? Then random result is always the same on android smartphone, but in simulator it always change, and the language is always en in my smartphone, but it is with language pt.
Bellow follows my calls of this functions and my config.lua, anyone can help me? Thanks!
Call 1:
function passaroVoar( event ) -- random x e ymath.randomseed( ( os.time() + progresso) \* 2 ); local x = math.random(1,screenW); if ( x \< 45 ) then x = 45; elseif (x \> screenW - 45) then x = screenW - 45; end math.randomseed( os.time() \* 3 ); local y = math.random(1,screenH); if ( y \< 45 ) then y = 45; elseif (y \> screenH - 45) then y = screenH - 45; end if ( x \> screenW - 305 and y \< 30) then passaroVoar ( event ) else birdSprite.x = x; birdSprite.y = y; end end
Call of system.getPreference:
if (system.getPreference("ui", "language") == "pt") then textoTempo = textoTempo; else textoTempo = "Time:"; end
and my config.lua
local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 320 or math.ceil( 480 / aspectRatio ), height = aspectRatio \< 1.5 and 480 or math.ceil( 320 \* aspectRatio ), scale = "letterBox", fps = 30, imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, }
Thanks!