How to detect mobile device

Get help using Construct 2

Post » Thu Jan 23, 2014 1:12 am

Due to the issue of not being able to play sounds on mobile unless the user initiates a click I want to add a sprite on each page I need sound that says "Start Level" however I only want to show this on mobile devices and thus looking for a way to determine if the user is on a mobile device. If they are I can just set a global variable and do the rest from there.

Help is much obliged.
B
14
S
2
Posts: 39
Reputation: 689

Post » Thu Jan 23, 2014 1:20 am

The Browser object has a "Is On Mobile Device" condition
B
47
S
14
G
7
Posts: 603
Reputation: 8,141

Post » Thu Jan 23, 2014 1:24 am

Yes just found that and was getting ready to reply - sorry about that looked for a long time and then right after I posted this I found:

"Is on mobile device
Tries to detect whether the current device viewing the project is a mobile (e.g. phone or tablet). It is 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/Intel XDK/CocoonJS containers, and always returns true for iOS, Android, Blackberry 10, Windows Phone and Tizen 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
14
S
2
Posts: 39
Reputation: 689

Post » Thu Jan 23, 2014 1:27 am

B
47
S
14
G
7
Posts: 603
Reputation: 8,141

Post » Tue Apr 29, 2014 11:20 pm

Found this to work sometimes and sometimes not detect as the article I quoted mentioned. Was hoping it would be a bit more consistent than that.
B
14
S
2
Posts: 39
Reputation: 689

Post » Fri Nov 11, 2016 4:00 am

Hey guy,I have same question.But I can't find the condition 'Is On Mobile Device' in Browser.
B
9
S
2
Posts: 13
Reputation: 551


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests