cancel
Showing results for 
Search instead for 
Did you mean: 

Get resolution or aspect ratio of host device or browser when loading app

If I could get PowerApps to tell me the actual resolution (or at least aspect ratio) of the device or web browser where an app launches, I could use logic to resize and reposition anything in the app.  This would be so useful, and would make the app at least appear to be responsive to the device.

 

For example, we could use logic to set the OnStart value to say:

 

If(Device.ScreenWidth > Device.ScreenHeight, 
	Set(AspectRatio, "landscape"), 
	Set(AspectRatio, "portrait")
)

 

Then we could reference the "AspectRatio" variable we set when the app launched for everything else.  As an example of this, let's say you want to show an image covering the whole width of the app if the app launches with a portrait aspect ratio, but you only want it to cover half the width of the app if it launches with a landscape aspect ratio.  You could do that referencing the "AspectRatio" variable to set the image width like this:

 

If(AspectRatio="portrait", 
	Parent.Width, 
	Parent.Width/2
)

 

I have not found any way to get this information, but surely the PowerApps platform could gather than information and pass it to the app, couldn't it?

 

This would make it SO much easier to develop one app that works well no matter what device accesses it.

Status: New
Comments
Level: Powered On

Now you can get updated App.Width and App.Height, you can test it just setting up an environment using the US preview and disabling the autoscale and block orientation under app settings.

 

Knowing the actual width and height is easy to calculate the orientation to determine if the device is in landscape or portrait mode.

 

If(App.Width/App.Height>1,Set(orientation,"landscape"),Set(orientation,"portrait"))

 

The only problem will be scalling text and this kind of things, because as far as I know currently there's no way of figuring out the actual pixel density of the device using the app.