I was looking for some way to launch my custom app from a Twitter app by clicking on a specific tweet.
The tweet may contain a link on which the user clicks and my app should be able open up.
As I understand I have two choices to do this with the intents.
The problem with the first approach is if I use a custom scheme, the twitter will not recognize it as a link and there for it is not clickable.
The problem with the second approach is that if I have some thing like this in my android application :
<intent-filter . . . >
<data android:scheme="http" android:host="project.example.com" />
. . .
</intent-filter>
and suppose if this is the tweet that the user clicks on :
here is the link : project.example.com
The twitter automatically will shorten the project.example.com
to suppose say t.co/something
At which point the intent-filter
listening to host project.example.com
will render useless coz, the link is now shortened.
Except these approaches, I am not able to find the solution to the aforementioned problem.
As I have mentioned initially, all I want to do is open my android app when a user clicks on a particular tweet(Not all the tweets, just the intended tweet). How do I do this?
Any kind of help will be greatly appreciated. TIA
first of all add Intent filter in Manifest to yours Activity (what you will launch):
<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:scheme="any.thing.u.want"/>
</intent-filter>
Second: in your tweets add link
any.thing.u.want://
For example, on JS it will be looked as
document.location.href='any.thing.u.want://'
That's all :) PS: Sorry for my English )
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.