Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

Difference between getFormFactor and getClient

(0) ShareShare
ReportReport
Posted on 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 at
    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 the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 72 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

Overall leaderboard