Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Headless background task can not be executed if barcode library is embeded #85

Closed
plake876 opened this issue Feb 25, 2019 · 7 comments · Fixed by #185
Closed

Headless background task can not be executed if barcode library is embeded #85

plake876 opened this issue Feb 25, 2019 · 7 comments · Fixed by #185
Labels
3.x Will be released in a 3.x release bug

Comments

@plake876
Copy link

Hi,
i have a problem using the library background_fetch (background_fetch: '^0.1.0') when I embed the barcode library.
I get the following exception if my background task starts:

java.lang.RuntimeException: java.lang.IllegalStateException: registrar.activity() must not be null
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:112)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:108)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at android.os.Looper.loop(Looper.java:166)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7425)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: Caused by: java.lang.IllegalStateException: registrar.activity() must not be null
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.apptreesoftware.barcodescan.BarcodeScanPlugin$Companion.registerWith(BarcodeScanPlugin.kt:19)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.apptreesoftware.barcodescan.BarcodeScanPlugin.registerWith(Unknown Source:2)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:22)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.example.xyz.Application.registerWith(Application.java:17)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.initFlutterView(HeadlessTask.java:133)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.(HeadlessTask.java:47)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessJobService.onStartJob(HeadlessJobService.java:38)
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at android.app.job.JobService$1.onStartJob(JobService.j
02-25 11:32:42.472 11461 11461 E AndroidRuntime: at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java)

See also Issue:
transistorsoft/flutter_background_fetch#12

@mohamedameer020
Copy link

mee too

@mohamedameer020
Copy link

transistorsoft/flutter_background_fetch#12

have you got any idea?

@pedrvaldir
Copy link

mee too, problem persists.

@galves93
Copy link

galves93 commented Nov 2, 2019

same problem here... i'm try has been 2 days and nothing, if someone can run, please tell us... rsrs

@rahulbagal
Copy link

We have same issue
I am using barcode_scan: ^1.0.0

Please check

Guard code against when running headless, since there is no Activity in the Headless context.

E/AndroidRuntime(23350): java.lang.IllegalStateException: registrar.activity() must not be null E/AndroidRuntime(23350): at com.apptreesoftware.barcodescan.BarcodeScanPlugin$Companion.registerWith(BarcodeScanPlugin.kt:19) E/AndroidRuntime(23350): at com.apptreesoftware.barcodescan.BarcodeScanPlugin.registerWith(Unknown Source:2) E/AndroidRuntime(23350): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:38) E/AndroidRuntime(23350): at in.milton.smartthings.Application.registerWith(Application.java:34) E/AndroidRuntime(23350): at com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.initFlutterView(HeadlessTask.java:180) E/AndroidRuntime(23350): at com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.access$400(HeadlessTask.java:32) E/AndroidRuntime(23350): at com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask$TaskRunner$1.run(HeadlessTask.java:210) E/AndroidRuntime(23350): at android.os.Handler.handleCallback(Handler.java:790) E/AndroidRuntime(23350): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(23350): at android.os.Looper.loop(Looper.java:164) E/AndroidRuntime(23350): at android.app.ActivityThread.main(ActivityThread.java:6494) E/AndroidRuntime(23350): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(23350): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) E/AndroidRuntime(23350): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) E/TSLocationManager(23350): [c.t.l.a.BackgroundGeolocation$e uncaughtException]

@devtronic devtronic linked a pull request Feb 22, 2020 that will close this issue
2 tasks
@devtronic
Copy link
Member

devtronic commented Feb 22, 2020

Will be fixed in 3.x. See #185 for details

@devtronic devtronic added the bug label Feb 22, 2020
@devtronic devtronic added the 3.x Will be released in a 3.x release label Apr 8, 2020
@devtronic
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x Will be released in a 3.x release bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants