Buildfire: How to detect user device? iOS vs Android?

874 Views Asked by At

I was wondering if it was possible to see what device users are operating the App from either through angular or Javascript. I am guessing there would be 3 states? Android, iOS, and PWA?

2

There are 2 best solutions below

1
On

Yes, it is entirely possible to use browser detection logic with JavaScript. Based on the browser you can determine which OS is being used. (Safari for iOS and Chrome for Android.)

See this StackOverflow posting covers one way to accomplish this.

If you wish to detect if it's a PWA on iOS, see this link.

0
On

This is the function that will tell you what platform the user is using.

                buildfire.getContext(function (err, result) {
                    if(result){
                        console.log(result);
                    }
                });