I’ve got a “Share on Facebook” button which launches an ACTION_SEND intent so the user can share some message on Facebook. After the user shares the message, he or she is returned to my activity. Additionally, he or she can return to my activity by pressing the back button while in the Facebook app.
Is there a way to detect whether or not he or she actually shared the message as opposed to pressing the back button? I’d like a solution that doesn’t require using Facebook’s api.
public void shareFacebook(String title, String url) {
String fullUrl = "https://m.facebook.com/sharer.php?u=" + url;
try {
Intent sendShareIntent = new Intent(Intent.ACTION_SEND);
sendShareIntent.setClassName("com.facebook.katana",
"com.facebook.katana.ShareLinkActivity");
sendShareIntent.setType("text/*");
sendShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, url);
startActivity(sendShareIntent);
} catch (Exception e) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(fullUrl));
startActivity(i);
}
}
You’d probably have to start the activity for result. and then handle it that way, this is assuming that the activity that you’re using supports this functionality.