As the share pop up appears, I shared the content on WhatsApp successfully, but still returns RESULT_CANCELLED. Same result when I send a email using Gmail.
Calling
I have the same problem and i think that the result will be always "Canceled" because even if the email is sent or no the activity will be killed.
startActivityForResult()
only works with activities that are intended to be called that way. If the activity you are calling doesn't explicitly return a result, you will get the default result RESULT_CANCELED. Obviously ACTION_SEND
is not designed to be called this way. The documentation for ACTION_SEND
indicates that is generates no output (ie: generates no result).
See the documentation for Activity.startActivityForResult()
:
Note that this method should only be used with Intent protocols that are defined to return a result. In other protocols (such as ACTION_MAIN or ACTION_VIEW), you may not get the result when you expect. For example, if the activity you are launching uses the singleTask launch mode, it will not run in your task and thus you will immediately receive a cancel result.