Device discovery if there is android?

I have a meteor application that is deployed for both ios and Android devices, and I want certain code to work only on the ios device, not on android. I know that I can detect a device using navigator.userAgent, but this will only work if I have an application running in a browser.

// This works if its browser

navigator.userAgent.toLowerCase().indexOf("android") > -1; 

But is there any possible way to detect the device if I created a package for android using the meleor cordova plugin, so it works like a native application.

+5
source share
1 answer

As Nigil Nair suggested using the Plugo Device Plugin . If you need help adding a plugin, see Meteor Cordova . After installing the plugin correctly, you can use var devicePlatform = device.platform; which will return one of the following based on the device:

  • Android
  • "BlackBerry"
  • IOS
  • startle
+8
source

All Articles