mirror of
https://github.com/simplezhli/flutter_barcode_reader.git
synced 2024-11-22 22:59:22 +08:00
App Crash with Background fetch plugin cleared
This commit is contained in:
parent
8455f159f6
commit
f7b09a9272
@ -16,9 +16,11 @@ class BarcodeScanPlugin(val activity: Activity): MethodCallHandler,
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun registerWith(registrar: Registrar): Unit {
|
fun registerWith(registrar: Registrar): Unit {
|
||||||
val channel = MethodChannel(registrar.messenger(), "com.apptreesoftware.barcode_scan")
|
val channel = MethodChannel(registrar.messenger(), "com.apptreesoftware.barcode_scan")
|
||||||
val plugin = BarcodeScanPlugin(registrar.activity())
|
if (registrar.activity() != null) {
|
||||||
channel.setMethodCallHandler(plugin)
|
val plugin = BarcodeScanPlugin(registrar.activity())
|
||||||
registrar.addActivityResultListener(plugin)
|
channel.setMethodCallHandler(plugin)
|
||||||
|
registrar.addActivityResultListener(plugin)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user