OneSignal Notification listener/launch args event sequence

Just wondering if there is a way of detecting if the app was opened from a push notification BEFORE the system event listener fires?  Right now I’m using the listener in GameThrive.Init().  So right now the flow is:

System Event>Game Thrive Listener

But I want:

Game Thrive Listener (or some way of detecting the app was opened via push) > System Event

I am currently handling the event sequence, it’s not really that complex but it seems more of a work around vs doing things in a different order.

I’m working on Android on this one.

Hello Phil,

GameThrive.Init() must be called for the notification callback to be fired as GameThrive needs to process the json message. Can you move your the code that depends on if your app was opened from a notification to the GameThrive callback?

Thanks.

Thats pretty much what I have done, the trouble is if the app was not opened from a push notification.  So currently I have a delay of 500msec, if the I get the callback from the game thrive listener then I cancel the delay and do the push notification logic.  However if the delay times out then I know the app was opened normally and not from a push but it just seems unnecessarily messy, vs. picking up some sort of flag before the system listener fires :slight_smile:

Just wanted to confirm that the gamethrive listener is the very earliest trigger I can use to detect the app was opened from a push and I had not missed anything else.

If you need to run code only when your app isn’t opened from a notification then I understand your issue. I believe most developers assume that the app was not opened from a notification then have there code react when one is opened. Does this kind of logic flow not work in your case?

This is the first request we have had for this issue but we will look into adding anther callback method to handle this scenario. Until then the only way I can think of detecting that an app as not been opened with a notification is using a delay like you are now.

Thanks.

@jkasten Sure, I can handle the flow however if I remember correctly if I use Coronas notification listener it fires before the system listener so I can set the appropriate flag, before the system listener fires and just use a simple bool value rather than delays and callbacks.  I could be wrong though, hence my question if there was anything earlier I could use.

Thanks for your help and looking into another method to handle the scenario would be great :slight_smile:

Maybe something in their new release might help

https://forums.coronalabs.com/topic/57309-onesignalsdk-190-release/?hl=%2Bbug+%2Bnotification

Sorry, nothing in the OneSignal 1.9.0 release to detect that the app was NOT opened from a notification. Only the same callback when a notification is opened, or received when the app is running.

Thanks.

Hello Phil,

GameThrive.Init() must be called for the notification callback to be fired as GameThrive needs to process the json message. Can you move your the code that depends on if your app was opened from a notification to the GameThrive callback?

Thanks.

Thats pretty much what I have done, the trouble is if the app was not opened from a push notification.  So currently I have a delay of 500msec, if the I get the callback from the game thrive listener then I cancel the delay and do the push notification logic.  However if the delay times out then I know the app was opened normally and not from a push but it just seems unnecessarily messy, vs. picking up some sort of flag before the system listener fires :slight_smile:

Just wanted to confirm that the gamethrive listener is the very earliest trigger I can use to detect the app was opened from a push and I had not missed anything else.

If you need to run code only when your app isn’t opened from a notification then I understand your issue. I believe most developers assume that the app was not opened from a notification then have there code react when one is opened. Does this kind of logic flow not work in your case?

This is the first request we have had for this issue but we will look into adding anther callback method to handle this scenario. Until then the only way I can think of detecting that an app as not been opened with a notification is using a delay like you are now.

Thanks.

@jkasten Sure, I can handle the flow however if I remember correctly if I use Coronas notification listener it fires before the system listener so I can set the appropriate flag, before the system listener fires and just use a simple bool value rather than delays and callbacks.  I could be wrong though, hence my question if there was anything earlier I could use.

Thanks for your help and looking into another method to handle the scenario would be great :slight_smile:

Maybe something in their new release might help

https://forums.coronalabs.com/topic/57309-onesignalsdk-190-release/?hl=%2Bbug+%2Bnotification

Sorry, nothing in the OneSignal 1.9.0 release to detect that the app was NOT opened from a notification. Only the same callback when a notification is opened, or received when the app is running.

Thanks.