Successful share intent for android

2019-01-08 16:13发布

How can i tell if a user successfully completed a share intent? For instance if a user wanted to share an app via Facebook or Twitter.

Edit:

I am not looking at how to create an Intent for sharing. I want to know if the user actually shared anything. Or did the user hit the cancel button.

3条回答
走好不送
2楼-- · 2019-01-08 17:00

For twitter - the "data" object in OnActivityResult is null when the user cancels the share.

查看更多
萌系小妹纸
3楼-- · 2019-01-08 17:08

You have use the Intent.ACTION_SEND, and the system will display a list of applications (on the device) where you can share. This website explains how:

http://sudarmuthu.com/blog/sharing-content-in-android-using-action_send-intent

查看更多
我想做一个坏孩纸
4楼-- · 2019-01-08 17:18

I don't think there is an assured way to do it.

You could initiate the send using startActivityForResult() and hope that the activity which handles the Intent replies with a RESULT_OK. But you can't rely on it to work always.

查看更多
登录 后发表回答