title: android 12, how replace the notification trampolines
body: <p>Having android sdk which intercept the push notification, and has been using notification trampoline to further open the end activity. In the case of deeplink the app who uses this sdk will open the configured deeplink handler activity.</p>
  <p>Snippet for the <code>trampoline</code>:</p>
  <pre><code>public class NotificationTrampolineReceiver extends BroadcastReceiver {
  @Override
      public void onReceive(final Context context, final Intent intent) {
          final PendingResult asyncResult = goAsync();
          ExecutorService executor = Executors.newSingleThreadExecutor();
          asycTask(executor, new Runnable() {
              @Override
              public void run() {
                  String urlStr = getStringExtra(intent, PUSH_URL);
                  if (urlStr != null) {
                      var intent2: Intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlStr));
                      if (intent2 != null) {
                          intent2.addFlags(FLAG_ACTIVITY_NEW_TASK);
                          intent2.addFlags(FLAG_ACTIVITY_BROUGHT_TO_FRONT);
                          context.startActivity(intent2);
                          logAnalytics(intent, Message.MessageAction.OPEN);                   
                       }
                  }
                  asyncResult.finish();
              }
          });
      }
  
      void asycTask(ExecutorService executor, final Runnable task) {
          try {
              executor.execute(task);
          } catch (Throwable ex) {}
      }
  }
  </code></pre>
  <p><a href="https://developer.android.com/about/versions/12/behavior-changes-12#notification-trampolines" rel="nofollow noreferrer">The <code>notification trampolines</code> is not working in Android 12 anymore</a>.
  The notification trampolines is needed in the sdk to intercept the click and do something like to log analytics event; closing the notification drawer when clicking at the <code>Action</code> button on the notification, etc. And this sdk does not know what activities the app may configure to handle the deeplinks.</p>
  <p>Using a dummy activity to replace the <code>trampoline</code> would work, but not feel right, i.e. open the activity and inside to open another one then finish this one.</p>
  <p>When android 12 puts restriction on the <code>notification tramoline</code>, does it suggest a replacement for the use case like the one here? Haven't find one.</p>
  <p>What is the suggested new solution for intercepting the push notification tap first and then open the activity?</p>