alann-maulana / flutter_beacon

An hybrid iBeacon scanner and transmitter SDK for Flutter Android and iOS.
Apache License 2.0
116 stars 142 forks source link

Foregroundservice: MissingPluginException #105

Open typexy opened 2 years ago

typexy commented 2 years ago

When trying to execute flutterBeacon.initializeScanning from a foreground service function, an exception is thrown: _Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel flutter_beacon)

0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)

1 FlutterBeacon.initializeScanning (package:flutter_beacon/flutterbeacon.dart:60:20)

Is this an issue on my side, or is this package not suitable for foreground services, @alann-maulana ?

The foreground service package I'm using, is android_long_task (0.4.7) and flutter_beacon (0.5.1) with flutter version 2.5.1

The code snippet is the following:

@pragma('vm:entry-point')
serviceMain() async {

  ServiceClient.setExecutionCallback((initialData) async {
    if (Platform.isAndroid) {
        await flutterBeacon.initializeScanning;
    }
}
VinniciusJesus commented 2 years ago

@typexy Did you get a solution?

ravinandan25 commented 2 years ago

facing the same issue when trying to initialize in isolate.

iles-Chester commented 2 years ago

Do you find any hit to do this?

barangungor commented 2 years ago

I tried and faced same error. I guess this plugin doesn't support for foreground services.

S0NN1 commented 1 year ago

Did anyone find a solution/alternative?