title: Google Play store : Android App reject due to Intent Redirection vulnerabilities
body: <p>We received a notification for app rejection due to Intent redirection and to accommodate those we applied some checks in our code but still app was rejected today. Can you please read below which details on App requirement as well changes done to accommodate errors/warnings.</p>
  <p><strong>Brief about App:</strong>
  Our app uses combination of TWA (PWA Wrapper) and Native Android code, where authentication stuff majorly happens in native code and then on successful login user will be redirected to PWA using TWA Launcher activity. And in order to return back to native code from TWA we are making use of Intent filters.
  We went through options provided in the email under &quot;<strong>Intent Redirection</strong>&quot; (<a href="https://support.google.com/faqs/answer/9267555" rel="nofollow noreferrer">here</a>), but none of 3 three exactly fits in our case i.e. from TWA Launcher web URL to Native android activity within same application. Although we added few extra checks, as shown in snippet below from webpage to Native code (Which is call by Depplink:</p>
  <pre><code>
  if (intent.`package` == null || !intent.`package`.equals(packageName)) {
      finish()
  }else {
      //Business logic
      // Open new activity from here
  }
  </code></pre>
  <p><strong>Below details fetch from Google play console portal.</strong></p>
  <p><em><strong>Pre-launch report details</strong></em></p>
  <p><strong>Intent Redirection</strong><br/>
  Errorbrightness_1Security
  <br/>Your app contains an intent redirection vulnerability. <a href="https://support.google.com/faqs/answer/9267555" rel="nofollow noreferrer">Please see this Google Help Centre article for details</a>.
  •   <strong>androidx.activity.ComponentActivity.startActivityForResult</strong></p>
  <p>Also at one place we were using <strong>startActivityForResult</strong> which is deprecated now and we replace it with new API (i.e. <strong>registerForActivityResult</strong>). Please refer code snippet below :
  <br/>// Code snippet
  <br/>Old Code:</p>
  <pre><code>val intent = Intent(this, TwaImplicationActivity::class.java)
   startActivityForResult(intent, AppConstants.RequestCode.TWA_IMPLICATION)
  </code></pre>
  <p>New Changes:</p>
  <pre><code>twaActivityStartForResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult -&gt;
      if(result.resultCode == Activity.RESULT_OK){
          if(viewModel.showEnrolment.get()!!){
              navigateToEnrolment()
          } else {
              navigateToLogin()
          }
      }
  }
  
  
  
  val intent = Intent(this, TwaImplicationActivity::class.java)
   twaActivityStartForResult?.launch(intent)
  </code></pre>
  <p>If anything, I missed. Please let us know correct place, where I missed security check in our app?</p>