umair13adil / simple_beacons_flutter

A flutter plugin project to range & monitor iBeacons.
Apache License 2.0
35 stars 42 forks source link

version 1.0.15 - setMethodCallHandler is never been called #18

Closed dariocavada closed 2 years ago

dariocavada commented 4 years ago

After upgrade to 1.0.15, the setMethodCallHandler never returns a value.

If you want to start beacon monitoring you have to manually call:

await BeaconsPlugin.startMonitoring;

If you try this code (taken from your example), the code prints out just STEP1 and not STEP2 and STEP3:

if (Platform.isAndroid) {
      print('****** STEP 1');
      BeaconsPlugin.channel.setMethodCallHandler((call) async {
        print('****** STEP 2');
        if (call.method == 'scannerReady') {
          print('****** STEP 3');
          await BeaconsPlugin.startMonitoring;
          setState(() {
            isRunning = true;
          });
        }
      });
    }
umair13adil commented 4 years ago

I will look into it, maybe 'scannerReady' method call is not properly invoked or blocked on the Android plugin side.

EricHier commented 3 years ago

I've got the same problem - did you find a solution?

jangruenwaldt commented 3 years ago

Yeah, if you use the code from the readme, it does not actually work. Specifically, _respondToCall is never called: if (Platform.isAndroid) { BeaconsPlugin.channel.setMethodCallHandler(_respondToCall); }

VinniciusJesus commented 2 years ago

@jangruenwaldt Could you give me a sample of the solution? I'm not getting

jangruenwaldt commented 2 years ago

@jangruenwaldt Could you give me a sample of the solution? I'm not getting

Just use an older package version I think. Or it was fixed, not sure.