Android的 - 重定向到存放如果不安装的应用程序(发布仪式,由网站) [英] Android - redirect to store if app not installed (launch from website)

查看:188
本文介绍了Android的 - 重定向到存放如果不安装的应用程序(发布仪式,由网站)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Android应用程序,当用户被重定向到一个自定义的协议,该协议将启动。 我们希望让用户重定向到谷歌/ Play商店的应用程序,如果不是他们的设备上安装。

有关iOS的,我们用这样的:<一href="http://stackoverflow.com/questions/1108693/is-it-possible-to-register-a-httpdomain-based-url-scheme-for-iphone-apps-like/1109200#1109200">Is它可以注册一个HTTP +基于域的URL方案的iPhone应用程序,如YouTube和地图? ......然而,这并不在Android上正常工作。

这是基本的工作流程:

  1. 在用户点击我们的网站链接
  2. 在用户被重定向到 customProtocol://site.com一些= PARAMS
  3. 如果应用程序被安装到设备知道该怎么办时, customProtocol:// URL访问和应用程序启动... ...但是 如果未安装该应用程序的Andr​​oid只是给不具备的页面 错误页面;以上为iOS没有出现在溶液一起工作。

这是我们如何能够在Android上实现这一点有什么想法?难道仅仅是不可能在Android?

解决方案
  

这是我们如何能够在Android上实现这一点有什么想法?

不是一个自定义协议(或者,更确切地说,是自定义方案)。 Android上的图案供你使用,你控制的URL。

例如,对吧code扫描仪的应用程序有其主要扫描活动的定义如下:

 &LT;! - 允许网络应用程序通过链接到http://zxing.appspot.com/scan推出吧code扫描仪。 - &GT;
  &LT;意向滤光器&gt;
    &lt;作用机器人:名称=android.intent.action.VIEW/&GT;
    &LT;类机器人:名称=android.intent.category.DEFAULT/&GT;
    &LT;类机器人:名称=android.intent.category.BROWSABLE/&GT;
    &lt;数据机器人:计划=HTTP机器人:主机=zxing.appspot.com机器人:路径=/扫描/&GT;
  &所述; /意图滤光器&gt;
 

然后, http://zxing.appspot.com/scan 的任何链接会做两件事之一:

  1. 如果该链接是从浏览器中单击在Android设备上,并且安装了吧code扫描仪,用户可以在显示的应用程序或显示与该链接关联的网页之间进行选择。

  2. 如果该链接被点击其他地方(Android设备没有应用程序,其他移动设备,台式机,笔记本等),浏览器会弹出网页的该URL,在其中你可以做任何你希望,包括可选重定向到Play商店

We have an android app that is launched when the user is redirected to a custom protocol. We want to have the user redirect to the google/play store for the app if it isn't installed on their device.

For iOS we use something like this: Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps? ... however this doesn't work on android.

This is the basic workflow:

  1. user clicks link on our site
  2. user is redirected to customProtocol://site.com?some=params
  3. if the app is installed the device knows what to do when customProtocol:// url is accessed and the app launches ... however if the app isn't installed android just gives a page not available error page; the solution above for iOS doesn't appear to work.

Any thoughts on how we can achieve this on android? Is it just not possible on android?

解决方案

Any thoughts on how we can achieve this on android?

Not with a "custom protocol" (or, more correctly, a "custom scheme"). The pattern on Android is for you to use a URL that you control.

For example, the Barcode Scanner app has the following defined for its main scanning activity:

  <!-- Allow web apps to launch Barcode Scanner by linking to http://zxing.appspot.com/scan. -->
  <intent-filter>
    <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="zxing.appspot.com" android:path="/scan"/>
  </intent-filter>

Then, any links to http://zxing.appspot.com/scan will do one of two things:

  1. If the link is clicked from a browser on an Android device, and Barcode Scanner is installed, the user can choose between displaying the app or displaying the Web page associated with the link

  2. If the link is clicked anywhere else (Android device without the app, other mobile device, desktop, notebook, etc.), the browser brings up the Web page for that URL, in which you can do whatever you want, including optionally redirecting to the Play Store

这篇关于Android的 - 重定向到存放如果不安装的应用程序(发布仪式,由网站)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆