Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Successful share intent for android

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.

like image 295
Steve D Avatar asked Jan 09 '12 19:01

Steve D


People also ask

What is Share intent android?

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.

What are the two types of intent in android?

There are two intents available in android as Implicit Intents and Explicit Intents.

What is intent in android with example?

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.


2 Answers

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.

like image 200
HRJ Avatar answered Oct 05 '22 23:10

HRJ


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

like image 45
Rony Tesler Avatar answered Oct 05 '22 23:10

Rony Tesler