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

Android app not launch sometimes when i touch the notification. #462

Closed GeceGibi closed 2 years ago

GeceGibi commented 3 years ago

Description:

Title explains the problem.

Environment

SDK Version: 3.2.0 SDK Added from Pub

Steps to Reproduce Issue:

  1. App open
  2. Press android home button or go home screen. (○ button )
  3. Send Notification to device.
  4. Close app manually from android app control screen ( ▢ button )
  5. Touch the notification

Anything else:

[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1151], locale en-US) • Flutter version 2.2.3 at D:\Flutter • Framework revision f4abaa0735 (6 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\####\AppData\Local\Android\Sdk • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = C:\Users\####\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.59.0) • VS Code at C:\Users\####\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.25.0

• No issues found!

jkasten2 commented 3 years ago

@GeceGibi Thanks for reporting. Could you provide the following details?

  1. Android Version(s)
  2. Device Model(s)
  3. Also any Android version and device models you don't see the issue on are useful too
  4. Does the issue only happen when you "4. Close app manually from android app control screen ( ▢ button )"?
  5. Could you share you logcat as an attached .txt / .log file?
    • Note when you swipe away the app in the log and when you open the notification too so we can find the right spot.

Also there are some upcoming changes that might improve or fix this issue I want to reference here:

GeceGibi commented 3 years ago

1-2-3 : This bug happening every time with this device: Redmi Note 9S (mobile) • 2f755042 • android-arm64 • Android 11 (API 30)

I tried every posibilities wtih this device too and app worked as espected: JNY LX1 (mobile) • EPHUT20220023166 • android-arm64 • Android 10 (API 29)

4: Nope, it's mean when notification comes up and app was closed for some reason maybe user do that maybe device energy save mode do that.

Yea, this pull request maybe resolve this issue.

zeucxb commented 3 years ago

Same problem here.

GeceGibi commented 3 years ago

@jkasten2 any changes ?

emawby commented 3 years ago

@GeceGibi The Reverse Activity Trampolining Implementation PR has been released on our Android Native SDK which will be a part of the next Flutter release which should come out shortly. Thank you for your patience!

GeceGibi commented 3 years ago

I tried with latest(3.2.1) version but this issue not fixed.

GeceGibi commented 3 years ago

I also tried with v3.2.2 but nothing changed.

jkasten2 commented 3 years ago

@GeceGibi Can you capture a full system logcat (verbose, without any filters) from just before tapping on the notification and 10 seconds after on the devices have issues? Android should hopeful tell us why the app did not launch after the notification was opened in this log.

@zeucxb Can you try the new 3.2.2 version? If you still see an issue please also provide the logcat noted above and the device models and Android versions you are seeing the issue on.

GeceGibi commented 3 years ago

https://github.com/OneSignal/OneSignal-Flutter-SDK/pull/464

I just waiting this pr. I think everything will be okey after this pr.

efraespada commented 3 years ago

@GeceGibi you can test the PR with this:

onesignal_flutter:
    git:
      url: https://github.com/efraespada/OneSignal-Flutter-SDK.git

Follow the PR #464 instructions.

GeceGibi commented 3 years ago

@GeceGibi you can test the PR with this:

onesignal_flutter:
    git:
      url: https://github.com/efraespada/OneSignal-Flutter-SDK.git

Follow the PR #464 instructions.

Nah it's not working either. Notifications not coming up to device when app closed.

I got roll back one signal version to 2.6.4 it's working fine right now.

gumilar1995 commented 2 years ago

Hi @jkasten2 ,

I'm facing same issue using version 3.2.3. Here is my device detail : Redmi Note 7 (mobile) • c4eecc7e • android-arm64 • Android 10 (API 29) I captured logcat of the system as you said from before tap the notification to 10s after issue occurs, you can see the log here : https://github.com/gumilar1995/files/blob/main/logcat.txt

aryany9 commented 2 years ago

Hi @GeceGibi, I am testing the Onesignal plugin on older android version (Nougat) and everything is working fine as expected. Looks like this issue is only on Android 10+ based devices. I am using Redmi Note 9 Pro where tapping on notification is not opening the app if the app is "just closed" (Removed from Recent App, Not force stopped). Most probably reason for app not getting launched could be either Android 10 or It's Redmi device (Higher Chances).

andrea689 commented 2 years ago

I tried with Android 7.0 and I have the same problem!

I solved it with version 3.0.0

GeceGibi commented 2 years ago

Crashlytics logs

OSNotificationRestoreWorkManager.java line 48
com.onesignal.OSNotificationRestoreWorkManager.beginEnqueueingWork
Fatal Exception: java.lang.RuntimeException: Unable to resume activity {net.memurlar/net.memurlar.MainActivity}: java.lang.IllegalStateException: WorkManager is not initialized properly.  You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4891)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4928)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2309)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8587)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by java.lang.IllegalStateException: WorkManager is not initialized properly.  You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.
       at androidx.work.impl.WorkManagerImpl.getInstance(WorkManagerImpl.java:156)
       at androidx.work.WorkManager.getInstance(WorkManager.java:184)
       at com.onesignal.OSNotificationRestoreWorkManager.beginEnqueueingWork(OSNotificationRestoreWorkManager.java:48)
       at com.onesignal.OneSignal.onAppFocusLogic(OneSignal.java:1390)
       at com.onesignal.OneSignal.onAppFocus(OneSignal.java:1375)
       at com.onesignal.ActivityLifecycleHandler.handleFocus(ActivityLifecycleHandler.java:182)
       at com.onesignal.ActivityLifecycleHandler.onActivityResumed(ActivityLifecycleHandler.java:88)
       at com.onesignal.ActivityLifecycleListener.onActivityResumed(ActivityLifecycleListener.java:91)
       at android.app.Application.dispatchActivityResumed(Application.java:455)
       at android.app.Activity.dispatchActivityResumed(Activity.java:1413)
       at android.app.Activity.onResume(Activity.java:1945)
       at io.flutter.embedding.android.FlutterActivity.onResume(FlutterActivity.java:569)
       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456)
       at android.app.Activity.performResume(Activity.java:8353)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4881)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4928)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2309)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8587)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
GeceGibi commented 2 years ago

@jkasten2 any update for this issue ?

Makarov96 commented 2 years ago

I have the same issue with the version onesignal_flutter: ^3.2.7 any update?

jkasten2 commented 2 years ago

@GeceGibi @aryanyadav9 Can you try again with onesignal_flutter 3.2.5 or newer? There was an Android regression bug mainly with notifications with Launch URL set (could have effect some other notifications).

Also just to confirm your message from before @GeceGibi, notification open is working correctly on your JNY LX1 device but not your Xiaomi Redmi Note 9S?

@GeceGibi @aryanyadav9 If you are only seeing an issue with Xiaomi devices can you post a reply with the information requested in [Needs details from community] Xiaomi - Notification Open - Not foregrounding app?

j-ixcayau commented 2 years ago

I have the same issue with Xiaomi, Huawei and Sky devices. This issue start after an migration of Flutter from 1 to 2.5, with the versions of One Signal that support Null safety

What I have noticed is that the package handle the push after on tap, is just that do not open the app

GeceGibi commented 2 years ago

@jkasten2 I always use the latest version of onesignal and im using with strandart notification payload not with url.

Also device receives a notification, but the application does not open when touched. The plugin was working fine in v2 but now I am not happy.

aswinpraja commented 2 years ago

The issue is not reproducible with latest(3.2.7), let me know if anyone else is facing the same.

Makarov96 commented 2 years ago

any update about this issue? or someone has been able to fix ?

ismailcaakir commented 2 years ago

I have same error in 3.2.7,

Many users find this annoying. I can't re produce bug.

onesignal_flutter: dependency: "direct main" description: name: onesignal_flutter url: "https://pub.dartlang.org" source: hosted version: "3.2.7"

does this work? https://stackoverflow.com/a/49586473/5281938

GHO5TMEDO commented 2 years ago

I have the same issue with Xiaomi using latest onesignal_flutter.

WaheedHussainHaans commented 2 years ago

Any updates on this facing same issue on redmi note 10 pro TIA

ItsManikantaGopi commented 2 years ago

Any Updates? facing same issue with Poco M2 Pro!

tamirrab commented 2 years ago

Same here

GeceGibi commented 2 years ago

Any Updates? facing same issue with Poco M2 Pro!

Nopeee. They just watching us and do nothing. I'm waiting for six month.

DavideArena commented 2 years ago

Same issue here with version 3.2.7 (i tried to update the version from 3.0.0 to 3.2.7, hoping for a fix, but problem is here yet), with android 10 and xiaomi device, click on every notification doesn't open the app (with simple notification with launch url either)

FeifanChang commented 2 years ago

same issue.

mmustafaget commented 2 years ago
Caused by java.lang.IllegalStateException
WorkManager is not initialized properly. You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.

androidx.work.impl.WorkManagerImpl.a (WorkManagerImpl.java:36)
androidx.work.WorkManager.enqueue (WorkManager.java)
com.onesignal.OSNotificationRestoreWorkManager.a (OSNotificationRestoreWorkManager.java:27)
com.onesignal.OneSignal.onAppFocusLogic (OneSignal.java:29)
com.onesignal.OneSignal.onAppFocus (OneSignal.java:78)
com.onesignal.ActivityLifecycleHandler.d (ActivityLifecycleHandler.java:75)
com.onesignal.ActivityLifecycleHandler.d (ActivityLifecycleHandler.java:28)
com.onesignal.ActivityLifecycleListener.onActivityResumed (ActivityLifecycleListener.java:4)
android.app.Application.dispatchActivityResumed (Application.java:438)

same issue

rishav130 commented 2 years ago

@jkasten2 why don't you do something about it instead of waiting for it to get fixed by itself with some magic. we all are facing this problem from a long time now, this is shameful one signal This functionality used to work very fine in native but in flutter it just doesn't work!!!

bwrelawan commented 2 years ago

better using 3.0.0 Version. Its okay to open notification on Xiaomi device but sometimes cant open. But better than nothing XD

nileshsoni97 commented 2 years ago

photofunny net_

photofunny net_ (1)

tamirrab commented 2 years ago

This Problem is solved. This issue is not from onesignal side just a MIUI issue (Redmi & Mi Mobiles). Solve this problem by enabling this option in setting of your app.

photofunny net_

photofunny net_ (1)

Sorry but I’m not sure you are right The previous version is working without it

Also, I can't ask the user to do this

GeceGibi commented 2 years ago

This Problem is solved. This issue is not from onesignal side just a MIUI issue (Redmi & Mi Mobiles). Solve this problem by enabling this option in setting of your app.

Sorry but I’m not sure you are right The previous version is working without it

Also, I can't ask the user to do this

Yeap absolutely. This is Onesignal problem. Previous versions working fine but 3.* versions has bugged.

nileshsoni97 commented 2 years ago

This Problem is solved. This issue is not from onesignal side just a MIUI issue (Redmi & Mi Mobiles). Solve this problem by enabling this option in setting of your app.

Sorry but I’m not sure you are right The previous version is working without it Also, I can't ask the user to do this

Yeap absolutely. This is Onesignal problem. Previous versions working fine but 3.* versions has bugged.

https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/488#issuecomment-1046113965

GeceGibi commented 2 years ago

it's not the solution btw and issue is not notification dialog show problem. it's when app closed in background and touched to notification dialog app not coming foreground. App not starting with notification touch.

murilots commented 2 years ago

Same issue with MI 8.

This issue not happen with flutter_local_notifications

supermnemonic commented 2 years ago

still issue

jkasten2 commented 2 years ago

Update

Huawei - With HMS push

The Huawei notification open not foregrounding the app issue will be part of the next release this week.

Xiaomi

Notification open not foregrounding the app is an issue for FCM pushes is still ongoing. See https://github.com/OneSignal/OneSignal-Android-SDK/issues/1494 for the latest details.

Others

There are no known issues with other devices or push types.

CC @Aksoyhlc

Samuelbrandani commented 2 years ago

same here

nan-li commented 2 years ago

Hi all,

(1) For the Xiaomi issue, thank you for waiting and the fix is now in the latest OneSignal-Flutter-SDK release, version 3.3.1.

(2) For the issue about WorkManager is not initialized properly, it is being tracked at https://github.com/OneSignal/OneSignal-Android-SDK/issues/1561 and investigated. Please see this comment if you have more details to share.

(3) Please open a new issue if you have a different issue than the 2 above.

Since most comments were about the Xiaomi bug, I will close this issue, but please reach out if you are running into any problems.

benjaminhorner commented 9 months ago

I am still facing the issue with version 5.0.3…