Page 1 of 1

How do I check which platform the code is executing on ?

Posted: Wed Oct 14, 2020 2:23 am
by kevinmcisaac

How do I check which platform the code is executing on , i.e., web browers, vs Android APK, vs iPhone?

I want to be able to use this in my Typescript or in an element property, i.e., [[hidden]


Re: How do I check which platform the code is executing on ?

Posted: Fri Oct 16, 2020 8:45 am
by Serhii Kulibaba

Hello,

Please search online for an appropriate solution. There are a lot of examples:
https://stackoverflow.com/questions/518 ... ng-ionic-4
https://forum.ionicframework.com/t/how- ... /138189/10


Re: How do I check which platform the code is executing on ?

Posted: Sat Oct 17, 2020 11:36 pm
by kevinmcisaac

I ended up using the ionic Platform (https://ionicframework.com/docs/angular/platform) service .

As its already in Appery all I had to in the screen I want to check the platfrom is:

  • add Platform to the "Internal includes", i.e., code/includes

  • add the variable "platform", type Platform and checked DI

  • call this.platform.platforms().includes('cordova')