Task: show custom message "Shared!" if the user shared info.

The essence of the problem:

  1. The user selects the application in which he wants to share info
  2. After selecting, go to the application that you chose
  3. here he suddenly changed his mind and canceled the sharing

The question is - how do I foresee this behavior and catch the cancellation of sharing? Is it possible?

    2 answers 2

    This is possible only if the sharing occurs through the service s k sk (VK, for example) and its authors have provided such an opportunity and provided an appropriate method. In all other cases, you cannot find out what the user did in another application.

    • But the system somehow flashes the default popup for me when I still fumbled information (message sent) and vice versa, if canceled, nothing happens. It turns out the application as it is still informed about the result of the sharing event. - Eugene Troyanskii
    • @EugeneTroyanskii, here is an analogue in English - tyk . In short, you can call startActivityForResult() and pray to the gods that at least something useful will come back to the onActivityResult() method. And whether it comes or not, it completely depends on the developers of the application, something grabbed Intent - YuriySPb
    • Thanks, after a long analysis, I came to the conclusion that without a custom market it is really impossible, thanks for the help. - Eugene Troyanskii

    try this

     startActivityForResult(shareIntent, shareRequestCode); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == shareRequestCode && resultCode == Activity.RESULT_CANCELED) { //показывать кастомное сообщение } } 
    • Unfortunately resultCode = 0 and when I fumbled and when I canceled the ball: ( - Eugene Troyanskii