[英]Open Android App with custom URL scheme
this questions has been asked in a similar way like a hundred times, though I still cannot find a proper answer to get my app to work the way I want. 尽管我仍然找不到合适的答案来使我的应用按我想要的方式运行,但已经以类似的方式(一百多次)询问了这些问题。 Maybe this is not possible which would be a valid answer of course.
也许这是不可能的,这当然是一个有效的答案。
I have an activity defined as follows in my app: 我的应用程序中定义了以下活动:
<activity
android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="MyActivityCustomUrlScheme" />
</intent-filter>
</activity>
When I start my App in the emulator and then open the browser and type a URL like: 当我在模拟器中启动我的应用程序,然后打开浏览器并输入如下URL时:
MyActivityCustomUrlScheme://mycustomHost.com?someOptions
the only thing happening is that chrome tries googling for it, which is not what I want. 唯一发生的事情是Chrome尝试对其进行谷歌搜索,这不是我想要的。 If I send myself an SMS with this scheme, the scheme inside is not recognised as such and not clickable :(
如果我通过此方案向自己发送SMS,则其中的方案无法被识别,因此无法点击:(
I want to do that, because I already have an iOS App in the store, which uses the scheme MyActivityCustomUrlScheme://mycustomHost.com?someOptions and it would be a lot of hazel to change it everywhere, as users get this url send by email or SMS. 我想这样做,因为商店中已经有一个iOS应用程序,该应用程序使用方案MyActivityCustomUrlScheme://mycustomHost.com?someOptions,在任何地方更改它都将非常麻烦,因为用户会通过以下方式发送此网址电子邮件或短信。 I'd be really thankful if someone can help me out on this problem.
如果有人可以帮助我解决这个问题,我将非常感谢。
Try to use definition of host
: 尝试使用
host
定义:
<activity android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="MyActivityCustomUrlScheme" android:host="mycustomHost.com" />
</intent-filter>
</activity>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.