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

[BUG] after running for some hours app restarts and the notification text changes to default. #9

Open
chocovish opened this issue Dec 30, 2020 · 9 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed more info needed More information is necessary to triage the bug

Comments

@chocovish
Copy link

This plugin works quite well except for the first time crash while granting permission.
what I noticed that if I run the app for few hours like 8-9hours it restarts autoomatically (as I can see the "time since" thing in notification changes). and the notification title and description text switch backs to default (keeps the flutter app running in the background). attaching screenshot.

image

@JulianAssmann
Copy link
Owner

JulianAssmann commented Dec 31, 2020

Thank you very much for the bug report!
What device are you using? On my Pixel 5 I didn't observe this behavior yet, but maybe some OEMs kill long running apps after a while.

@JulianAssmann JulianAssmann added the bug Something isn't working label Dec 31, 2020
@JulianAssmann JulianAssmann self-assigned this Dec 31, 2020
@JulianAssmann JulianAssmann added the help wanted Extra attention is needed label Jan 4, 2021
@daurin-oshin
Copy link

daurin-oshin commented Jan 12, 2021

Good and excellent library. The same thing happened to me on a galaxy s9, the service only lasted 15 minutes, it only happened once for now, I don't know what the problem will be, maybe android kills the service, any other reason for this bug?

@JulianAssmann
Copy link
Owner

Interesting... Do you have any console logs available from when it resets/cancels the foreground service?
I will try and investigate, but so far I haven't been able to reproduce the problem on my own device :(

@JulianAssmann JulianAssmann added the more info needed More information is necessary to triage the bug label Feb 23, 2021
@akospwc
Copy link
Contributor

akospwc commented Mar 22, 2021

Excellent library, thank you for creating this, Julian!

For what it's worth, I am also experiencing this on a Samsung device. Might be unrelated, but Crashlytics also reported crashes at the same time. Let me know if you'd like me to create a separate issue for this instead (crash is coming from Samsung and Pixel devices, which covers 100% of the install base of our app)

Caused by java.lang.IllegalArgumentException: Parameter specified as non-null is null: method l.v.d.j.b, parameter intent
       at de.julianassmann.flutter_background.IsolateHolderService.onStartCommand(:2)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4723)
       at android.app.ActivityThread.access$2000(ActivityThread.java:301)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2168)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8456)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

@JulianAssmann
Copy link
Owner

Thank you very much for the information, I will look into it when I have some time to spare :)

@ViniciusDiasSilva
Copy link

I have the same problem.
Excellent library!
Thanks!

@JulianAssmann
Copy link
Owner

JulianAssmann commented Mar 31, 2021

Thank you for your kind words and the comment.
Do you have the same stack trace as @akospwc or some other error?

@akospwc
Copy link
Contributor

akospwc commented Jul 8, 2021

I believe what's happening here is that the app crashes and the OS automatically restarts the service. In this case initialize() is not getting called in time, meaning we are reverting to the default text.

I was able to reproduce this behavior with the example app:

  • $ cd example
  • $ flutter run
  • start the demo by pressing Connect
  • press 'q' on the console to exit the app

The notification disappears and then reappears in a few seconds with the default text.

I fixed this by storing the notification's configuration in shared preferences and then reloading them before use. @JulianAssmann would you mind taking a look?

akospwc@b942e4a

@luohao123
Copy link

Does hits merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed more info needed More information is necessary to triage the bug
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

6 participants