OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

Old notifications are restored with app launch, no way to detect the restoring state like 3.x.x

Open bluemix opened this issue 2 years ago • 1 comments

Description:

I've implemented the background service extension, to do some background stuff for notifications. However, when notifications are received (completed) and displayed to the user, and everything is OK, but, whenever the user closes the app and run the app again, the same notifications are restored!

The OneSignal Android doc says there is a restoring flag for the received notifications, but it didn't exist!

Environment

  1. Androiod SDK 31
  2. Maven
  3. OneSignal v4.6.5

Steps to Reproduce Issue:

  1. Background process the notification and mark it as completed
  2. Wait for 2 minutes and close the app
  3. The same notification is restored

bluemix avatar Jan 17 '22 15:01 bluemix

@bluemix Thanks for reporting, we will look into provide a way to detect or preventing the need to filter on this in the future.

Workarounds

Option 1

Track the notification id in your app so you don't process the data more than once.

Option 2

Set a low or 0 TTL on your notifications. The OneSignal SDK omit restoring notifications if their TTL has expired.

jkasten2 avatar Jan 18 '22 19:01 jkasten2