distinguishing android or ios

distinguishing android or ios

  

Is there anyway to see by code is it is an android native app or ios?

Solution

Hi Filipe,

In the CommonPlugin, there are some actions you can use to find information about the device:

Cheers.

Solution


Filipe,

In the WebPatterns you can use the action CurrentOS to identify the device OS

CurrentOS is currently not done to mobile , but its very easily to make it work on offline, just open  a clone of webpatterns, enter the CurrentOS action, and copy paste it into a client action, since it's all ifs and assigns, it will convert all of them to offline ones.

Silk team is already aware of this and will come in a future version (if it's not already, I haven't really seen latest release notes) but you can do this workaround for now.

You can also do something like this in a Javascript node in a mobile app:

Code: 


var isMobile = { 
   Android: function() { 
      return navigator.userAgent.match(/Android/i); 
   }, iOS: function() { 
      return navigator.userAgent.match(/iPhone|iPad|iPod/i); 
   } 
}; 
if(isMobile.Android()) { 
   // Do stuff 
} else if(isMobile.iOS()) { 
   // Do stuff 
}