title: How can I know what app or button user has clicked in the app chooser?
body: <p>I am trying to make a clone of Uber Driver app. 
  I got this part covered, where upon receiving a client's request notification,  the app will prompt an App Chooser for user choose what 3rd party app (e.g. Google Map or Waze) to navigate to the client's location after the user chose to accept client's request.</p>
  
  <pre><code>public static final int APP_CHOOSER_LOCATION = 101;
  
  acceptBtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              String uri = "geo:" + locationInfo.getLatitude() + ","
                      +locationInfo.getLongitude() + "?q=" + locationInfo.getLatitude()
                      + "," + locationInfo.getLongitude();
              Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
              startActivityForResult(intent, APP_CHOOSER_LOCATION);
  
              isBack = true;
  
          }
      });
  </code></pre>
  
  <p>So the problem is how do I know user has finish with his/her navigation?
  My current solution is putting an indicator <code>isBack</code>. By default it will be <code>false</code>. When user has click accept, <code>isBack</code> is set to <code>true</code>.
  So, in the onResume function, if <code>isBack</code> is equal to <code>true</code>, it will proceed to open another activity.</p>
  
  <pre><code>@Override
  public void onResume(){
      super.onResume();
  
  
      if(isBack){
  
          // Proceed to open another actvity
  
          isBack = false;
      }
  
  }
  </code></pre>
  
  <p>However, this does not work if the user click the <strong>Cancel</strong> button.</p>
  
  <p><strong>App Chooser Screenshot</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Yzkwp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yzkwp.jpg" alt="Image"></a></p>
  
  <p>I tried using <code>onActivityResult</code> but the <code>resultCode</code> always shows 0 (or <code>RESULT_CANCELED</code>) no matter what app I clicked.</p>
  
  <pre><code>@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      Log.i(TAG, "in onActivityResult ");
      Log.i(TAG, "resultCode:: "+resultCode);
  
      if (requestCode == APP_CHOOSER_RESPONSE){
          if(resultCode == RESULT_OK){
  
              Log.i(TAG, "user select app ");
              if(isBack){
                  // Proceed to open another activity
  
                  isBack = false;
              }
          }
  
          if(resultCode == RESULT_CANCELED){
              Log.i(TAG, "is cancelled by user ");
              isBack = false;
          }
      }
  }
  </code></pre>
  
  <p>Is my approach wrong? Or did I miss anything in my code? 
  I am stuck here and I do not know how to proceed. Any advice is appreciated.</p>