Not an easy thing, I know, but I wondered if anybody has previously done this and found a way to be fairly accurate? I'm guessing not automatically as the information returned for application:getDeviceInfo() for Android only returns the version currently according to the Gideros docs.
There is other information, which was improved with 3.0, that it would be useful to also expose using getDeviceInfo() for Android that would make the job easier:
http://developer.android.com/guide/practices/screens_support.htmlAnd details of the constants here:
http://developer.android.com/reference/android/content/res/Configuration.htmlIt's obviously easy on iOS to do this and, unless this information can be exposed so we can do our own logic, I'm thinking that the only other option would be to have a setting on the Android distribution of the app that allowed the user to turn on 'tablet mode' in the app and change displays accordingly.
Thoughts appreciated.
Comments
I did this kind of thing (and different sized buttons on mobile/tablet) in my last game in the app store. A good example of a very popular game that does this is Plants vs. Zombies - they tailor buttons and menus (at least on iOS, not sure about Android) to either mobile or tablet to avoid the game having "gigantism" on tablets.
Afaik, iOS doesn't provide a way to get the screen density but we can use a table similar to http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple For Android, I'll try to find if it's possible to get screen density at runtime (for Android 2.2+)
Screen density, in conjunction with device width and height, should give enough to make a pretty accurate decision on whether it's a mobiel or tablet.
Nowadays I'm trying to release a new version. If it's possible to get screen density on Android 2.2+, I'll add this function to that release.
Likes: moopf