How to discover another app's intent

2019-06-24 10:54发布

问题:

I'm trying to build an app to receive shares from the StumbleUpon app. I can, at this point, receive the browser's "share url", but when sharing from StumbleUpon my app does not show up on the list.

I'm thinking that I may not have registered the correct Intents in the manifest. Is there any way to find what that app is doing?

Thanks.

回答1:

You can get a bit of information about intents from logcat. When I shared in StumbleUpon I noticed this in the log:

12-08 19:01:18.915: I/ActivityManager(139): Starting activity: Intent { act=android.intent.action.SEND typ=text/plain flg=0x3000000 cmp=com.google.android.gm/.ComposeActivityGmail (has extras) } from pid 4213

From that, I was able to get an app to show up in the StumbleUpon share list with the following filter:

<intent-filter>
   <action android:name="android.intent.action.SEND" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="text/plain"/>
</intent-filter>