cancel
Showing results for 
Search instead for 
Did you mean: 

Identify where the app is running with RunTime.IsBrowser, Runtime.Name, RunTime.UserAgent, & more

Currently there is not an easy way to identify on which platform the app is running. 

 

This makes thing difficult to detect unsupported features.

 

Case in point: SaveData and LoadData are not supported in browsers.

These functions throw errors when tested on browsers. 

But there is no easy way to detect browsers, to wrap them around an IF and avoid triggering the error. 

 

Other features unsupported could be GPS, compass, altimeter touchscreen. 

 

My proposal then, is to provide a RunTime object, with the necessary functions and properties to make the developer life easier:

 

RunTime object - provides several information about the runtime environment where the PowerApp is running. 

 

Properties: 

 

RunTime.IsBrowser - Boolean - is true when the app is being run inside a web browser window.

 

RunTime.Name - String - Name of the runtime environment where the app is running, from a Dictionary. 

 

(Dictionary) Runtime.Names = {

  "Google Chrome", //includes beta, dev, canary builds

  "Edge Chrome", //includes beta, dev, canary builds

  "Edge Classic",

  "Mozilla FireFox",

  "Chromium", //fallback for all other chromium variants

  "Safari",

  "Opera",

  "Teams", //When the app is running on a tab inside Microsoft Teams

  "iOS", //iPhone

  "iPadOS", //iPad

  "Android",

  "Other"

}

 

RunTime.UserAgent- String - UserAgent of the runtime environment, as provided. Can be a Browser Uasr-Agent string, or a string provided by the apps in the several platforms that have them. 

 

RunTime.Version- String - Version of the runtime environment where the app is running, like can be see in "Session Details: PowerApps X.XXX.XXXX"

 

RunTime.SessionID- String - UUID of the SessionID of the app, like can be see in "Session Details: SessionID: UUID"

 

RunTime.SupportedFeatures - collection of key(string)-value(boolean) - lists every feature with a true or false value, to easily identify which ones are not available. List the Properties, Objects, Methods of PowerApps.

Example: RunTime.SupportedFeatures.SaveData will have a true or false value depending on platform. 

 

RunTime.IsBrowser = Boolean - true if the app is running inside a browser runtime. 

 

Methods: 

Runtime.IsSupported( "featurename as string") - returns true or false if a feature is supported. "featurename" should be any object or method listed in the documentation.

Example: RunTime.IsSupported("SaveData") will return true  on mobile or false on browsers. 

 

 

Status: New
Comments
Level 8

Super well-written, well done!

 

Also, super useful.