Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Auto-detect Mobile or PC

Author
Message
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 11th Mar 2017 11:45
Hello

I have a variable in my game which I set to "mobile" or "pc" depending on whether I am testing my game on which device. Is there a way to auto-detect if the game is running on a PC or Mobile device?

Thanks.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Mar 2017 11:54
GetDeviceBaseName

Returns a string containing the name of the current platform. This will only refer to the base platform, i.e. "windows", "ios", "android", "mac", or "blackberry". Use GetDeviceType to get more information about the specific device. This string will always be lower case.

GetDeviceType

Returns a string containing a device specific string, this will be different for each platform, for example on Windows it will return the OS version "vista, "7", "xp", etc. On iOS it will return the iOS device name "ipad1,1", "ipod2,1", "iphone1,2", etc. For Android it will return the device model "nexus 7", etc. For Mac it will return the OS version "10.7", "10.8", etc. This string will always be lower case
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 11th Mar 2017 15:00
That's brilliant. Thanks Batvink!
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 13th Mar 2017 15:23
BatVink:
Would this command return Android for both handhelds and TV boxes? Or does it say something like Android TV?

Login to post a reply

Server time is: 2024-04-16 12:44:58
Your offset time is: 2024-04-16 12:44:58