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.
Intent class to send data from one activity to another and from current activity to outside the application. Intent class needs to specify the data and its type which is to be share. Most commonly, ACTION_SEND action sends URL of build-in Browser app.
There are two intents available in android as Implicit Intents and Explicit Intents.
Intents are used to signal to the Android system that a certain event has occurred. Intents often describe the action which should be performed and provide data upon which such an action should be done. For example, your application can start a browser component for a certain URL via an intent.
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.
For twitter - the "data" object in OnActivityResult is null when the user cancels the share.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With