App Crash with Background fetch plugin cleared

This commit is contained in:
mjafartp 2019-06-08 17:42:23 +05:30 committed by GitHub
parent 8455f159f6
commit f7b09a9272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,11 +16,13 @@ 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")
if (registrar.activity() != null) {
val plugin = BarcodeScanPlugin(registrar.activity()) val plugin = BarcodeScanPlugin(registrar.activity())
channel.setMethodCallHandler(plugin) channel.setMethodCallHandler(plugin)
registrar.addActivityResultListener(plugin) registrar.addActivityResultListener(plugin)
} }
} }
}
override fun onMethodCall(call: MethodCall, result: Result): Unit { override fun onMethodCall(call: MethodCall, result: Result): Unit {
if (call.method.equals("scan")) { if (call.method.equals("scan")) {