I know there are probably more 'elegant' and efficient ways of doing it but this has proven helpful to me over the last couple of weeks. Just thought it might help someone else :)
Global Platform:Int =0
Const Platform_Mobile = 1
Const Platform_Internet = -1
Const Platform_Desktop = 0
Function CheckPlatform:Int()
Platform =Platform_Desktop
#If TARGET="android" Or TARGET="ios" Or TARGET="winphone8"
Platform = Platform_Mobile 'mobile
#Else
#If TARGET="html5" Or TARGET="flash" Or TARGET="java"
Platform =Platform_Internet 'internet
#Endif
#Endif
Return( Platform )
End
Basically call CheckPlatform() at the beginning of OnCreate and then you can check the Platform variable against the constants to see what you are currently running on be it either mobile, internet or desktop platforms :)
|