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

does not work when app killed by the user #13

Open
xnio94 opened this issue Aug 14, 2020 · 6 comments
Open

does not work when app killed by the user #13

xnio94 opened this issue Aug 14, 2020 · 6 comments

Comments

@xnio94
Copy link

xnio94 commented Aug 14, 2020

I'm not sure if its the intended behavior or not but the callback does not fire if the user kills the app, the notification is always showing but it does nothing.

i tried with two tasks :

and in both cases, the plugin does not work when the app is killed (even if the foreground notification is still showing in the tray)

"extra: my use case is to run a callback periodically that check if the GPS is enabled, if yes update a document in firebase if not notify the user (this should work even if the user killed the app accidentally)"

@PriyaSindkar
Copy link

I am facing the same issue when I switch off location permission from settings while the foreground service is still running

stacktrace-

java.lang.RuntimeException: Unable to start service changjoopark.com.flutter_foreground_plugin.FlutterForegroundService@2d593f7 with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3902) at android.app.ActivityThread.access$1700(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1846) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6912) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference at changjoopark.com.flutter_foreground_plugin.FlutterForegroundService.onStartCommand(FlutterForegroundService.java:23) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3883) at android.app.ActivityThread.access$1700(ActivityThread.java:212)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1846)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:6912)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860) 

@FabulousGee
Copy link
Contributor

I have a similar issue. For me, my OS is stopping the main app after a few hours and then the callback isn't called anymore.

From what I understand, the method channel gets destroyed in the process (and flutter gets detached from engine). I am not sure though since this is all pretty hard to debug for me.

Any ideas how to solve this so far? I was thinking of re-starting the activity via intent maybe. I want to avoid moving all the stuff into an own plugin (which should also keep running then just like the foreground service) since I want to keep it in Dart

@SGuzel
Copy link

SGuzel commented Aug 24, 2020

For me the same. If the app has been closed by the user, the foreground service is detached. App is killed and no more notifications.

Is there any fixes?

How to prevent the app being killed or how the delete the ongoing push notificaition too?

Thanks,
-Sue

@xnio94
Copy link
Author

xnio94 commented Sep 24, 2020

did anyone find a solution for this?

@seo345
Copy link

seo345 commented Oct 7, 2020

Any idea?? still not working when app is closed, this means that the plugins is useless...

@Unzilla
Copy link

Unzilla commented Jan 17, 2021

Is it working?if not how to resolve this?

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