Disable plugins when in desktop browser


#1

Is there some way to conditionaly run a code related to cordova plugins only if app is running on a mobile platform and not in a desktop Chrome? In the docs I’ve found that there are methods like isAndoid(), but it returns true even if my app is started on a desktop PC with Chrome. I’ve got such an easy thing to handle:

$scope.onHold = function(product) {
   if (isAndoid()) {
	$cordovaVibration.vibrate(50);
   } else {
        alert('does not vibrate here');
   }
}

–Rafal


#2

Check for Cordova. Something like…

if(window.cordova){
    //Plugins Available
}

#3

Thank you. It works as I needed :smile: