Find which platform your game is running

Get help using Construct 2

Post » Wed Jan 16, 2013 7:01 pm

Is there a way to find which platform your game is running on like ios , andriod , web, etc..? because i am redirecting user to the Ratings/Review page , so based on the platform i have to route it to the right landing page. Also i am using cocoonJS to bundle them into mobile.

B
16
S
4
Posts: 248
Reputation: 2,267

Post » Wed Jan 16, 2013 8:58 pm

The system event has a "is on mobile" check that will help you with part of that.

Is on mobile device
Tries to detect whether the current device viewing the project is a mobile (e.g. phone or tablet). It is very difficult to accurately detect this so detection may not be perfect: there may be some mobile systems for which Is on mobile is not true, and (although less likely) desktop systems for which Is on mobile returns true. The condition always returns true when packaged via the PhoneGap or AppMobi containers, and always returns true for iOS or Android based devices. Beyond that Construct 2 will test a few other common mobile manufacturers. Otherwise, it will return true if the current system is not a desktop system, since there are relatively few desktop OSs; the desktop systems it checks for are Windows, Linux, OS 9, OS X, Solaris and BSD.
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Fri Jan 18, 2013 11:55 am

@tringio

Try using navigator.userAgent to know which platform your game is running on
B
9
S
4
G
4
Posts: 383
Reputation: 3,616

Post » Fri Jan 18, 2013 1:35 pm

@ludei - users cannot directly access javascript from Construct 2. However you can get the user agent string from the Browser object, using the expression Browser.UserAgent.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul, TELLES0808 and 21 guests