简体   繁体   English

使用自定义uri启动android应用

[英]launch android app with custom uri

I tried to launch my android application with a link into an email. 我试图启动带有电子邮件链接的android应用程序。

https://hostname.com/somethingAndParameter

My server redirect this link to: 我的服务器将此链接重定向到:

myscheme://host

i tried this intent-filter but it doesn't work: 我试过这个意图过滤器,但是不起作用:

<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:host="host" android:scheme="myscheme"/>
</intent-filter>

Since you are not understanding by way of comments, let's try an answer... 由于您无法通过评论来理解,因此请尝试一个答案...

Change your <intent-filter> to: 将您的<intent-filter>更改为:

<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="https"
           android:host="hostname.com"
           android:path="/somethingAndParameter"/>
</intent-filter>

Now your https://hostname.com/somethingAndParameter URL works on: 现在您的https://hostname.com/somethingAndParameter URL适用于:

  • iOS, because you said that you have this working iOS,因为您说过可以使用
  • Web, because you said that you have this working 网络,因为您说您已经在工作
  • Android, because now when a user taps on this link (in an email or whatever) on most Android devices, the user will get a chooser, allowing the user to choose your application to process the link Android,因为现在当用户在大多数Android设备上点击此链接(通过电子邮件或其他方式)时,该用户将获得一个选择器,允许用户选择您的应用程序来处理该链接

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

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