I have such code (angular.js
) to detect mobile platform and redirect to native-app (if not installed - then it redirect to market):
$scope.isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if($scope.isMobile.Android()){
$timeout(function() {
$window.open(
'https://play.google.com/store/apps/details?id=***&referrer=' + $routeParams.inviteId,
'_self'
);
}, 500);
}
if($scope.isMobile.iOS()){
window.location = '***://?referrer=' + $scope.inviteId;
setTimeout("window.location = 'https://itunes.apple.com/us/app/****/id***';", 1000);
}
and now i have one question:
how to do this on windows phone
platform?
do windows phone recognize themselves is app installed or not (as android do) or i need to go as iOS
do?\
also how can i pass parameter to application (like android do)?