Bug Issue: "Running on Mobile" block return false on Html5 games played on mobile.


Pages: 1

havana24

  • Subscriber - Stencyl Studio
  • *
February 13, 2020, 05:51:42 am
Hi there,

if you run an HTML5 game on your phone with a mobile browser the block "Running on Mobile " return false instead of true.
I think that this behavior is also extended to the "Do only on Mobile" block aswell.

-Alessandro


rob1221

  • Master Stencyler
  • *
February 14, 2020, 10:58:37 am
Those blocks are based on the conditional compilation tags where mobile is a separate platform from html5.

Checking for a mobile browser is pretty tricky according to what I've read on Stackoverflow, so in my games I opted to check for touch support instead using this code:
Code: [Select]
untyped __js__('window.navigator.maxTouchPoints || "ontouchstart" in document')
Attached is a behavior with a custom block that returns true if on native mobile or if on html5 with touch support.
« Last Edit: February 14, 2020, 11:01:04 am by rob1221 »


New attachment added by rob1221 - February 14, 2020, 10:59:39 am


Issue updated by Justin - June 03, 2020, 01:22:59 am
  • Tags added: documentation


Pages: 1

Details

  • Reported
    February 13, 2020, 05:51:42 am
  • Updated
    June 03, 2020, 01:22:59 am

  • View Status
    Public
  • Type
    Bug
  • Status
    New
  • Priority
    Normal
  • Version
    (none)
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Engine

Tags


Attachments


* Detect Touch Support.png (11.46 kB, 64x64 - viewed 57 times.)