OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
615 stars 213 forks source link

[Bug]: Android, if change orientation, not working setNotificationWillShowInForegroundHandler #616

Open VisualMafia opened 1 year ago

VisualMafia commented 1 year ago

What happened?

When you change the screen orientation, pushes start coming as if the application is hidden or unloaded. The setNotificationWillShowInForegroundHandler method is not called.

Options: onesignal_flutter: 3.4.2 flutter version: Flutter 2.10.5 • channel stable compileSdkVersion 31

logs: D/OneSignal( 4808): Configuration Orientation Change: PORTRAIT (1) on activity: app... D/OneSignal( 4808): ActivityLifecycleHandler Handling lost focus D/OneSignal( 4808): Application stopped focus time: 1196909 timeElapsed: 109 D/OneSignal( 4808): FocusTimeProcessorUnattributed:saveUnsentActiveData with lastFocusTimeInfluences: [SessionInfluence{influenceChannel=iam, influenceType=DISABLED, ids=null}, SessionInfluence{influenceChannel=notification, influenceType=DISABLED, ids=null}] D/OneSignal( 4808): FocusTimeProcessorUnattributed:getUnsentActiveTime: 0 D/OneSignal( 4808): FocusTimeProcessorUnattributed:saveUnsentActiveTime: 109 D/OneSignal( 4808): ActivityLifecycleHandler handleFocus, nextResumeIsFirstActivity: true D/OneSignal( 4808): ActivityLifecycleHandler reset background state, call app focus D/OneSignal( 4808): OSFocusHandler running onAppFocus D/OneSignal( 4808): Application on focus D/OneSignal( 4808): Application foregrounded focus time: 1306137 D/OneSignal( 4808): isPastOnSessionTime currentTimeMillis: 1668458588911 lastSessionTime: 1668458479693 difference: 109218 D/OneSignal( 4808): Starting new session with appEntryState: APP_OPEN D/OneSignal( 4808): OneSignal cleanOutcomes for session D/OneSignal( 4808): OneSignal save unattributedUniqueOutcomeEvents: [] D/OneSignal( 4808): OneSignal SessionManager restartSessionIfNeeded with entryAction: APP_OPEN

Steps to reproduce?

1. Launch;
2. Rotate android device

What did you expect to happen?

The screen orientation should not affect the behavior of push notifications.

OneSignal Flutter SDK version

3.4.2

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

VisualMafia commented 1 year ago

In version 3.5.1 the problem remained.