Functionality,  Helpful hints

Detecting mobile device app operation

There is a generally simple method of detecting a mobile device where

Location.Altitude > 0 || Acceleration.X > 0

being true will detect a mobile device (as opposed to a PC), but we now have “cross-over” devices with these sensors being used as office PCs – so how do we detect them? What we really need to know is if the app is being run in a browser or on the Mobile App.
One method I have tested which works is this – try to save a file with SaveData – at App OnStart, run this

Set(
   gblDevice,
   If(
      IsError(
         SaveData(
            Table(
               {Value: 1},
               {Value: 2}
            ),
            "MyTest"
         )
      ),
      "Desktop",
      "Mobile"
   )
)

and then test gblDevice for the value.
NOTE: This will only work properly on a PC / browser if this setting is switched off in the App.

Leave a Reply

Your email address will not be published. Required fields are marked *