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
Did you face the same or similar issue? How did you solve it? Any help would be very appreciated. Thank you!
I'm using a transparent activity to handle this issue. all the notification related works are handled in the transparent activity.
Intent intent = new Intent(mContext, NotificationActivity.class);
intent.putExtra("notification", parseInt(this.mActionDetail.getNotifyId()));
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);
notificationManager.notify(parseInt(this.mActionDetail.getNotifyId()), builder.build());
create a transparent activity NotificationActivity.class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With