GoCarrot / teak-android

Carrot SDK for Android
Apache License 2.0
0 stars 0 forks source link

Android 11 & 12 PendingIntents Overwriting #101

Closed ZeroStride closed 2 years ago

ZeroStride commented 2 years ago

On Android 11 & 12 PendingIntents for notification launches will overwrite each other.

Repro Case

The cause is that PendingIntent.getActivity is called with a requestCode of 0, instead of a random integer.

The fix is to replace that hard code of 0 as well as random integers with an atomic incrementing integer. Because the context will be different if the app is closed and then another notification comes in, the PendingIntent will still be unique.

ZeroStride commented 2 years ago

Ok that part about the context isn't true. Use SecureRandom.