I read here ( http://androidlittle.blogspot.com/2009/08/intent-filter-for-share-link.html ) what intent-filter is required to handle the "share link" intent that the android web browser sends. I have placed this inside an block in my AndroidManifest.xml like so:
<activity android:name=".ShareLink">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<meta-data/>
</activity>
I cannot for the life of me get this to be triggered though. When I share a link in the android browser, the emulator log shows it's creating a chooser intent, but doesn't give the details of the intent the chooser is acting on. No chooser window pops up, and the intent gets handled by the SMS application.
I have also tried kicking off the intent manually:
adb shell am start -D -a android.intent.action.SEND -c android.intent.category.DEFAULT -t text/plain -d http://google.com/
but the response I get is:
Starting: Intent { act=android.intent.action.SEND cat=[android.intent.category.DEFAULT] dat=http://google.com/ typ=text/plain }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.SEND cat=[android.intent.category.DEFAULT] dat=http://google.com/ typ=text/plain flg=0x10000000 }
Can anyone tell me what I'm doing wrong? My main (launcher) activity works fine, so I assume there is no issue with installation on the emulator.
whoops!
Turns out, I had got the package installed initially but upon reinstallation it was silently failing. In between those two builds I fixed the manifest to be as you see above - the installed version didn't have the intent-filters specified, which obviously wouldn't work.
Guess I'll leave this here in case someone has the same need? Or should I just delete it?