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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Determine Current Conn...
Power Apps
Unanswered

Determine Current Connection Method - Canvas App

(0) ShareShare
ReportReport
Posted on by 439

Hi everyone,

 

Bit of an unusual request and hoping the community can help! I am working on a Canvas App which is optimised for smartphone use, but in some cases will be used on a desktop/laptop device.

The user has a requirement that some behaviours in the App will differ depending on the data connection method that is in use, which may be one of:

 

  • Ethernet
  • Laptop using Wi Fi
  • Cellular phone using Wi Fi (this would be the same network as the Laptop)
  • Cellular phone using cellular data ('public' 4G/5G) etc.

Is there a method in Power Apps to determine the current connection method (and/or the Power Platform more widely - for example, Power Automate would also be acceptable as we could mitigate for the output from the App in a Flow if this was the only option)?

 

Please let me know if any further details are required, thank you for your comments!

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    Not really, but you can do this to determine if you are on a browser or a mobile device

    Set(OnBrowser, !Or(Host.OSType="Android", Host.OSType="iOS"));
  • pp365 Profile Picture
    439 on at

    Thank you @TheRobRush , that's definitely helpful.

     

    In terms of:

    Host.OSType="Android", Host.OSType="iOS"

     

    These are presumably set to 'true' when the user is using the Power Apps Mobile App and the OS is Android or iOS (Install the Power Apps mobile app - Power Apps | Microsoft Learn) - is that correct? So the parameter is set by the user using the Power Apps Mobile App?

    Are there parameters to detect if the Host is Windows or Mac OS? Or is the only determining factor whether the user is using iOS or Android and therefore if they are not using these we assume they are on a browser, but it's not possible to determine anything further than that?

    Apologies, hope that was clear enough and thank you again!

  • Verified answer
    TheRobRush Profile Picture
    11,128 Moderator on at
    Host.OSType

    Will return, from what I have personally tested, iOs, Android, and Windows. I have to assume it would also return Mac.

    I use it solely for determining if a user is on a mobile device or pc so I know which versions of some formulas to use etc for best performance so the version I provided does that.

  • pp365 Profile Picture
    439 on at

    Hi @TheRobRush / everyone,

     

    Thanks again for the help on this @TheRobRush . I wanted to check a final query; on the Microsoft Learn Page for this object (Host object in Power Apps - Power Platform | Microsoft Learn), it says;

     

    "Note

    Don't use the OSType to change experience or functionality of your app based on the reported operating system."

     

    I would like to know the rationale for this? Is it unreliable? Or some other reason?

     

    While I am not looking to change the App behaviour, I am looking to use the value in a Switch case in a Flow linked to the App to perform a different action depending on the OS detected when a button is pushed in the App. Is this object sufficiently dependable for this?

     

    Many thanks!

  • TheRobRush Profile Picture
    11,128 Moderator on at

    I believe that is probably due to this section

    This is dangerous as Power Apps is designed to be run on a wide spectrum of hardware and software platforms and your Host based logic may not account for them all and they will change over time.

    and is just Microsoft covering it's bases. In my use case we utilize powerapsp on browsers, cell phones, and ipads. The host device ostype accounts for all of these. So long as you stay up to date in case of any syntax changes etc it will do this job just fine. And is, in my experience, the most accurate and fast way to determine if your user is in a mobile or dekstop use scenario

  • pp365 Profile Picture
    439 on at

    Thanks @TheRobRush . I've marked your original reply as the solution to this thread. Users will benefit from reading the entire thread for context though, along with Microsoft's 'disclaimer'.

  • pp365 Profile Picture
    439 on at

    @TheRobRush for info and for the benefit of anyone using this thread in the future, unhelpfully, the Microsoft documentation is incorrect for the terminology on the OSType property when a Mac is being used.

     

    It is noted as returning 'macOS'. My testing confirms it is actually returned as 'Mac OS'.

     

    Sharing in case this is helpful for others.

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Yah this is one of those scenarios I meant when I said when you will jus tneed to keep an eye on the syntax.

    Curious is this an older Mac or newer one. Was doing some research and it seems like in 2016 macs os started being macOS but before that it was Mac OS. So maybe thats why if it's running something Pre-Sierra/2017, or if Apple just changed again. Might be best to just refer to Macs as 'macOS' || 'Mac OS' to cover your bases though.

  • pp365 Profile Picture
    439 on at

    Many thanks again @TheRobRush , noted about the syntax suggestion. The Mac used for testing is a MacBook Pro, Apple M1 chip, running on Sonoma 14.0 - so definitely post-2016/17. This adds importance to your point of using both 'macOS' and 'Mac OS' as possible outputs from Power Apps. 

     

    The desired implementation is in a Flow (triggered by an action in the App), so in case helpful for the Community, to include @TheRobRush 's suggestion, both 'Mac OS' and 'macOS' could be added as an 'Or' option in a Condition. Alternatively the following expression should work:

     

    Or(equals([SOURCE TO CHECK]'Mac OS'),equals([SOURCE TO CHECK]), 'macOS')).
     
    For example, if the source was a Compose action named 'text';
     
    Or(equals(outputs('text'), 'Mac OS'),equals(outputs('text'), 'macOS'))

     

    (Source info: https://learn.microsoft.com/en-us/power-automate/use-expressions-in-conditions)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard