简体   繁体   English

如果应用程序不存在 android,电子邮件链接不会重定向到 Play 商店

[英]email link not redirecting to play store if app not exists android

In android mobile it shows open with the domain/app which i already installed.but if the app is not there it is not redirecting to play store.在 android mobile 中,它显示使用我已经安装的域/应用程序打开。但如果应用程序不存在,则不会重定向到 Play 商店。 can anyone help on this.任何人都可以帮助解决这个问题。 the link is like http://www.example.com/message链接就像http://www.example.com/message

<action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data android:scheme="http"
          android:host="www.example.com"
          android:pathPrefix="/message" />

That is the expected behavior.这是预期的行为。

If you want to redirect to the Play Store when the app is not installed, you need to build a system to do that.如果您想在未安装应用程序时重定向到 Play 商店,则需要构建一个系统来执行此操作。 Chrome intents can partially handle this, but only in Chrome. Chrome 意图可以部分处理这个问题,但只能在 Chrome 中处理。 You need something like Firebase Dynamic Links or Branch.io (full disclosure: I'm on the Branch team)您需要 Firebase Dynamic Links 或Branch.io 之类的东西(完全披露:我在 Branch 团队)

<html lang="en">
<head>
 <meta charset="UTF-8">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript">


function launchAndroidApp(url) {
     //var appleAppStoreLink = 'https://play.google.com/store/apps/details?id=PACKAGEID';
     var appleAppStoreLink =  'market://details?id=PACKAGEID'
     var now = new Date().valueOf();
     setTimeout(function () {
          //if (new Date().valueOf() - now > 500) return;
          window.location = appleAppStoreLink;
     }, 200);
     window.location = url;
}

function launchiOSApp(url) {
     var appleAppStoreLink = 'https://itunes.apple.com/us/app/MY-APP/APPID';
     var now = new Date().valueOf();
     setTimeout(function () {
          if (new Date().valueOf() - now > 500) return;
          window.location = appleAppStoreLink;
     }, 100);
     window.location = url;
}
function launchWeb(url) {
    window.location = url;
}


$(function() {
     $('#my-link').click( function () { 
          var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
          var android =  /(Android)/g.test( navigator.userAgent );
          if(android) {
              //alert("tst");
              launchAndroidApp('http://www.example.com'); 
          }
          else if(iOS) {
              launchiOSApp('http://www.example.com');
          }
          else {
              launchWeb('http://www.example.com');
          }
     });
});

</script>

</head>
<body>
<a id="my-link" href = "#">web-link</a>
</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM