Old notifications are restored with app launch, no way to detect the restoring state like 3.x.x
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
- Androiod SDK 31
- Maven
- OneSignal v4.6.5
Steps to Reproduce Issue:
- Background process the notification and mark it as completed
- Wait for 2 minutes and close the app
- The same notification is restored
@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.