web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : Vf1+WA1tbXLF9RmizuDACm
Power Apps - Power Apps Pro Dev & ISV
Answered

Difference between getFormFactor and getClient

Like (0) ShareShare
ReportReport
Posted on 7 Jul 2022 18:36:45 by 5

Hi,

 

I am trying to determine if my PCF component should render in mobile layout or a web layout. I did not want to use the allocatedWidth and allocatedHeight to determine the layout as this may be a hit or miss and we cannot set a valid threshold to choose a layout (mobile or web) in all scenarios.

 

However, I found the Client.getFormFactor() and Client.getClient() methods and thought that may be the solution. But I can't seem to understand these API in PCF.

 

When creating a Canvas app in a Mobile layout in Power Apps Web client, the getClient() returns "Web" and getFormFactor() returns 1. When will the getClient() return "Mobile" and getFormFactor() return 3 (for Phone)?

 

https://docs.microsoft.com/en-us/power-apps/developer/component-framework/reference/client

 

  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on 13 Jul 2022 at 18:53:41
    Re: Difference between getFormFactor and getClient

    Hi @mapguy2006 , 

     

    The Canvas App "mobile layout" it's just a setup for the size of the screen.

    The client.getClient() tells you where the app is running. As long you call the Canvas App in the webBrowser, you will always get "Web". When the Canvas App is running inside a Mobile App you'll get "Mobile".

     

    So the same App, will have the client.getClient() "Web" when the app is running in the browser, and will be "Mobile" if the app is running in Power Apps Mobile (iPhone, Android App or Power Apps for Windows).

    The "client.getFormFactor" will tell you what device is used.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete