Android 12 – Notification trampoline restrictions

Hi due to android 12 the Notification trampoline restrictions leads to a big problem in my project. I’m developed an SDK and it’s used to show local notifications.
My problem is that I’m using the notification is to show a banner or open a web view inside the application. For the Notification trampoline restrictions I need to
specify the notification click event using pending intent.
My issue is that from the SDK side I find out the application bundle Id and lunch the
MainActivity, in every time I’m tapping the notification the application is relaunched
even if the application is in the background or foreground.

I need to know about the following

  1. how can I know when the application is alive in the foreground or background
  2. if it exists need to know which activity is at the top of the stack

Did you face the same or similar issue? How did you solve it?
Any help would be very appreciated. Thank you!

Source: Android Questions