How do I handle the browser's "share page" intent in android?
Posted
by gfxmonk
on Stack Overflow
See other posts from Stack Overflow
or by gfxmonk
Published on 2010-05-22T01:21:18Z
Indexed on
2010/05/22
1:30 UTC
Read the original article
Hit count: 659
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.
© Stack Overflow or respective owner