Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Callback after sharing intent completes

I'm using the following code to share stuff on my android app:

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "blah blah blah");
this.startActivity(Intent.createChooser(shareIntent, "Choose a sharing option:"));

I need to know if the user did share with success or if it failed. Is there anyway to get a callback when the sharing action is complete?

like image 861
JHNeves Avatar asked Mar 27 '14 03:03

JHNeves


1 Answers

Use startActivityForResult, that ways will be able to check the response. Please check: startActivityForResult

If you need to have more control on the process, you shouldn't use the Sharing Intent approach. Instead you can use Twitter4j library for twitter and the Facebook SDK for Android for Facebook sharing.

like image 62
hmartinezd Avatar answered Nov 11 '22 13:11

hmartinezd