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

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

Open Dipannita20 opened this issue 2 years ago • 8 comments

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 avatar Jul 04 '22 12:07 Dipannita20

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

Dipannita20 avatar Jul 08 '22 13:07 Dipannita20

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 avatar Jul 23 '22 12:07 MATAUDI

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

MATAUDI avatar Aug 03 '22 17:08 MATAUDI

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

ChristianTBaker avatar Nov 07 '22 22:11 ChristianTBaker

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

fatderda avatar Nov 17 '22 17:11 fatderda

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

twelve-cgn avatar Dec 14 '22 11:12 twelve-cgn

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);

fatderda avatar Dec 23 '22 21:12 fatderda

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>);

fhboswell avatar Dec 29 '22 01:12 fhboswell