Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App is in closed State tapping on notification not getting any data with 4.1.0 Android 4.0.0 works fine #315

Open
Dipannita20 opened this issue Jul 4, 2022 · 8 comments

Comments

@Dipannita20
Copy link

Dipannita20 commented Jul 4, 2022

Description:

App is in closed state on Android tapping on notification NotificationOpened not getting fired, failed to captured additional data passed on to notification for deep linking.
OneSignal.Default.NotificationOpened += _notificationOpened;

Environment

  1. Xamarin forms 5.0.0.2125
  2. Migrated OneSignal 3.10.6 to 4.1.0
  3. Started seeing this error

Steps to Reproduce Issue:

  1. Add 4.1.0 to all the projects
  2. Build app and swipe away, app is in closed state
  3. Send push notification from OneSignal Portal, with additional data
  4. Observe addition data is missing
  5. Observe log in Android logcat -> OneSignal.Default.NotificationOpened += _notificationOpened; not getting called in closed state
  6. Observe OneSignal.Default.NotificationOpened += _notificationOpened; getting called in app is in background/foreground

Anything else:

(crash stacktraces, as well as any other information here)

Attached Android logcat during the test flow
onesignal_exception.txt

@Dipannita20
Copy link
Author

@tanaynigam @jkasten2 any update on this, do you need any more information on this?

@MATAUDI
Copy link

MATAUDI commented Jul 23, 2022

I have the same problem, when the app is in closed state, "OneSignal.Default.NotificationOpened += _notificationOpened;" stops working, but if the app is in the foreground or background it works correctly.

Is there any way to fix this?

@MATAUDI
Copy link

MATAUDI commented Aug 3, 2022

@tanaynigam @jkasten2 any news on this? Do you have any idea what could be causing this to happen?

@ChristianTBaker
Copy link

I am also having this issue. I would like to deep link from the closed state on android, but this problem is blocking me. Works on iOS

@fatderda
Copy link

Same issue here (OneSignalSDK.Xamarin 4.1.3 & Android Target 13.0). Any news on this?

@twelve-cgn
Copy link

Same issue here but with OneSignalSDK.Xamarin 4.3.0 and iOS. On Android everything works great.

@fatderda
Copy link

Finally found a solution for this problem (Android 13).
I had to put the NotificationOpened handler before the OneSignal initialization. The handler probably worked when the app was in background because then the handler was set (as opposed to a cold start).

OneSignal.Default.NotificationOpened += HandleNotificationOpened;
OneSignal.Default.Initialize(YourOneSignalKey);

@fhboswell
Copy link

fhboswell commented Dec 29, 2022

I was able to reproduce the issue that you have been experiencing @Dipannita20. I have tested @fatderda's solution and it works.
If your NotificationOpened handler is not firing on cold start put the NotificationOpened handler before the OneSignal initialization.

OneSignal.Default.NotificationOpened += HandleNotificationOpened;
OneSignal.Default.Initialize(<OneSignalAppId>);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants