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

Moderator: Support

kevinmcisaac
Posts: 37
Joined: Mon Oct 05, 2020 8:27 am

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

Post 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]

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

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

Post 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

kevinmcisaac
Posts: 37
Joined: Mon Oct 05, 2020 8:27 am

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

Post 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')

Post Reply