1

我想知道是否可以进行以下重定向:

假设一个智能手机用户在他的手机上安装了我的手机应用程序,他点击了一个指向我指定的目标 URL 的网络链接。我想让目标 url 将用户重定向回已安装的手机应用程序并转到应用程序中的特定页面。所以程序是

Safari|QR 码扫描 --> 我的网址 --> 打开我的手机应用程序 --> 在应用程序中加载目标页面。

可以为 iOS 和 Android 实现此重定向吗?我将非常感谢有关此的任何信息。

谢谢!

4

1 回答 1

2

对于 ios,您可以在 info.plist 中定义一个 url 方案。然后,您可以在应用程序委托中处理 url。一个很好的教程位于here

http://mobiledevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

在 android 上,您将其设置为数据意图过滤器

<data android:host="string"
  android:mimeType="string"
  android:path="string"
  android:pathPattern="string"
  android:pathPrefix="string"
  android:port="string"
  android:scheme="string" />

http://developer.android.com/guide/topics/manifest/data-element.html

它作为启动应用程序的意图中的数据组件到达

<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="myhost" android:pathPrefix="/details" />
</intent-filter>

但是,我不确定 android 上的所有浏览器实际上是否会测试其他应用程序是否会在将其加载为下一页之前接受 url 方案。

于 2012-08-09T04:19:11.227 回答