didReceiveRemoteNotification isActive parameter always false?

Title says it all. Whether app is open or not when a notification comes in, the isActive property is always false, and I’d like to use this to determine whether to automatically process the notification (if you entered the app to see it) or give you the choice of processing it (if you were already in the app).

Here’s the relevant info from the onesignal docs:

Callback Parameters

  • String message - The message text the user seen in the notification.
  • Table additionalData - Key value pairs that were set on the notification.
    • Table stacked_notifications - Contains a Table for each notification that exists in the stack. “message” as well as keys listed above and ones you set with additional data will be available.
  • boolean isActive - True if your app was currently being used when a notification came in.

function DidReceiveRemoteNotification(message, additionalData, isActive)

OK I got it working, by forcing the following values to be what in theory are their default values:

enableNotificationsWhenActive = false

enableInAppAlertNotification  = false

Hopefully it’ll keep working!

enableNotificationsWhenActive and enableInAppAlertNotification are stored in the app’s data. If you set them to true before in your code they would only be reset once the app is fully uninstalled.

So realistically I’m best not touching them or forcing them to false each time I enter just to hope they fix the problem next time around?

You can test to make things are still working by removing those 2 calls and fully uninstall your app before testing.

OK I got it working, by forcing the following values to be what in theory are their default values:

enableNotificationsWhenActive = false

enableInAppAlertNotification  = false

Hopefully it’ll keep working!

enableNotificationsWhenActive and enableInAppAlertNotification are stored in the app’s data. If you set them to true before in your code they would only be reset once the app is fully uninstalled.

So realistically I’m best not touching them or forcing them to false each time I enter just to hope they fix the problem next time around?

You can test to make things are still working by removing those 2 calls and fully uninstall your app before testing.