How to check platform "android" & "browser"?


#1

I developed an application that can be run through the browser & It published also on Google Play
So, If users open my app by browser of android phone, i want to check this case to move them to the Google play to download it to use the full features.
Any helps please ?


#2

This is what i found in this forum and use in v4:

this.isApp = (!document.URL.startsWith(‘http’) || document.URL.startsWith(‘http://localhost:8080’));


#3

Hi @_Ali94 :wave:

I think the easiest way is to import the Platform service from @ionic/angular, inject it in the constructor and then checking for a specific platform like if (this.platform.is('android')) or if (!this.platform.is('cordova')) for the browser.

You can find all the platform names here: https://github.com/ionic-team/ionic/blob/master/angular/src/providers/platform.ts#L91

Best,
Rodrigo