I am writing an app for a community, which has the ability to share URLs.
In the android browser, there is the possibility to forward URLs, for example from my HTC Desire to a BlueTooth Target, to Facebook, to Friend Stream, to Google Mail, to Google+, Mail, SMS and Peep. What I want to achive is to add my app into that list, providing functionality to forward the current URL from the Browser to the App, regardless on which webpage I am currently.
How do I achive that?
Best Answer
You do this with intent-filter, with the action SEND. This filter will take plain texts, images and videos.
In your activity you can check
getIntent().getAction().equals(Intent.ACTION_SEND)
to know you have been started as a send action andgetIntent().getType()
what type of data you got.The data itself (Text, image or anything else) can be found via
getIntent().getExtras().get(Intent.EXTRA_STREAM)
orgetIntent().getStringExtra(Intent.EXTRA_TEXT)
(Depends on data type and the sending application).