开发者

Intent filter to catch links from SMS doesn't work

开发者 https://www.devze.com 2023-02-05 13:57 出处:网络
I\'ve read many posts on stackoverflow and doc on the Android API in order to be able to catch links from SMS or mail. For example, if I receive开发者_运维知识库 a SMS containing a link like myapp://h

I've read many posts on stackoverflow and doc on the Android API in order to be able to catch links from SMS or mail. For example, if I receive开发者_运维知识库 a SMS containing a link like myapp://hello, I want to to be clickable and to open my application once clicked.

I found how to do it using an intent filter on the activity I want to activate. Here is my code:

   <intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="myapp"></data>

I tried it first with android:scheme="http" and it worked well (when I clicked a link from a SMS, Android asked the user which app to use: browser or myapp). However when I want to do so with myapp instead of http, it doesn't work...indeed the link myapp://hello is not clickable...so it's impossible to launch myapp clicking on it...

Do you have any idea ? Do I have to activate something, somewhere to tell Android to parse this kind of addresses ?

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消