I am using this method to call share my feed data:
public void shareFeed() {
try {
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "SUB");
intent.putExtra(Intent.EXTRA_TEXT, "Body");
startActivityForResult(Intent.createChooser(intent, "Choose an Email client :"), 1);
} catch (Exception e) {
e.printStackTrace();
}
}
and here's my onActivityResult code but I got data every time null in either success or fail :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
}
}
}
I want to perform call web-service after success so I need the share intent callback result.
ACTION_SEND
does not return any form of result. Quoting the documentation:
Output: nothing
There is no point in using startActivityForResult()
, and you will not get a result.
On API Level 22 (Android 5.1) and higher devices, you are welcome to use the createChooser()
variant that takes an IntentSender
as a parameter. This will let you know what choice the user made out of the chooser. However:
That will not tell you if the user sent anything
I do not think that you find out anything if the user just abandons the chooser (though you might interpret the absence of a choice as indicating abandonment)
The documentation for ACTION_SEND indicates that is generates no output (ie: generates no result).
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