当应用程序没有安装时,如何将用户重定向到(android,ios)市场
how to redirect the user to the (android ,ios) market when the app doesnt installed
我有一个处理自定义URL方案的应用程序(Myapp://)。当有人访问包含一些Myapp://内容的网页时,如果他们没有安装我们的应用程序,我们需要将他们重定向到商店。
在android中,如果应用程序未安装,您可以使用Intents作为url打开应用程序或重定向到google play。
我需要从java脚本中完成
你可以这样更改位置:
window.location.href = "intent://test#Intent;package=com.test.app;end;";
对于android,你需要在url方案中提到包名,比如package=comXYZ.ABC,然后如果设备上没有应用程序,android系统会自行处理并打开播放商店。我不知道IOS。
boolean installed = appInstalledOrNot("your package name");
if(!installed)
{
final String appPackageName = yourpackagename for the app to be installed;
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details? id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}
我再次非常非常彻底地阅读了你的问题。我希望我现在能正确理解你:
- 你有一个应用程序
- 你有一个网页
- 如果有人打开网页并安装了你的应用程序,应用程序就会启动
- 如果有人打开网页却没有你的应用程序,他们应该被转发到相应的应用程序商店
对于最后一种情况:当您使用javascript时,您应该能够检查设备类型(使用jQuery),然后执行以下操作:
window.open('https://play.google.com/store/apps/details?id=' +
yourPackageName);
请参阅:重定向到应用商店或谷歌播放
相关文章:
- 通过javascript重定向html传递php变量
- JavaScript下拉菜单-点击按钮并根据所选值重定向到url
- 使用angular重定向到html页面
- 如何在chrome扩展中重定向到html页面
- 在Android中通过javascript捕获页面重定向'的WebView
- 当应用程序没有安装时,如何将用户重定向到(android,ios)市场
- Android WebView:设置 iframe src 会重定向页面
- 重定向至document.ready在android浏览器中的另一个页面
- iOS/Android检测和重定向
- 重定向至“从网站访问Android应用程序”诊断树
- 如何在Android上正确重定向到Play Store
- Android - Scheme URL -链接重定向到应用程序
- 从Sharepoint网站重定向到移动网站不运行的Android用户
- 如何在Android Web视图中检测重定向
- Phonegap android重定向到三星galaxy不工作的url
- 从android webview中的网页重定向
- 在iOS/Android上暂停浏览器时刷新/重定向URL
- Android/iOS WebView未遵循CORS HTTP重定向(30x)
- 窗口.位置重定向在Android中不起作用
- 停止加载网页上的Url重定向android