my application shares messages to other social apps using intent with action send. what I want is that when this message clicked it openes a certain activity in my app if it is installed on the other device
Something like this can be achieved with Intent filters (assuming your app is installed on device which opens the message).
Let's say you send this URL together with your message: http://myapp.com/whatever
(format is up to you). After user will click on the link the following will happen:
OK, now that we know how it works under the hood let's declare our own intent-filter for our URL:
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="myapp.com"
android:path="/whatever"
android:scheme="http" />
</intent-filter>
</activity>
Now after user will try to open your URL he will be prompted to use MyActivity to open the link.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.