Home > database >  Is it possible in an angular web app to run slightly different code on mobile using capacitor?
Is it possible in an angular web app to run slightly different code on mobile using capacitor?

Time:06-25

I would like to add google ads to my app, but you need to use admob for web and adsense for mobile. First I wanted to use angular native, but I couldn't get it running and I found capacitor, but I don't quite understand their doc about Environment Specific Configurations. Any advice how could I do it?

CodePudding user response:

You can use getPlatform() or isNativePlatform() to check the environment:

if (Capacitor.isNativePlatform()) {
  // Native app running on Android or iOS
}
  • Related