simple_beacons_flutter icon indicating copy to clipboard operation
simple_beacons_flutter copied to clipboard

version 1.0.16 - setMethodCallHandler is never been called

Open daveleenew opened this issue 4 years ago • 7 comments

version 1.0.16 - setMethodCallHandler is never been called.

never been called

daveleenew avatar Sep 07 '20 08:09 daveleenew

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

In my testing, I found out that the method is called when I move the app to the background. When entering it again, the beacon scanner stops monitoring again.

EricHier avatar Oct 31 '20 18:10 EricHier

Me too, I found same problem on some android device, but ios no problem.

dhachayawat avatar Dec 14 '20 11:12 dhachayawat

version 1.0.20 - setMethodCallHandler is never been called too. but for iOS is working fine.

jallynme avatar Mar 22 '21 06:03 jallynme

Same problem. Any solution?

baranacikgoz avatar Feb 25 '22 13:02 baranacikgoz

@baranacikgoz which platform do you use?

barangungor avatar Feb 25 '22 15:02 barangungor

@baranacikgoz which platform do you use?

` if (Platform.isAndroid) {

  //Prominent disclosure
  await BeaconsPlugin.setDisclosureDialogMessage(
      title: "Need Location Permission",
      message: "This app collects location data to work with beacons.");

  //Only in case, you want the dialog to be shown again. By Default, dialog will never be shown if permissions are granted.
  await BeaconsPlugin.clearDisclosureDialogShowFlag(false);
}

BeaconsPlugin.channel.setMethodCallHandler((call) async {
    if (call.method == 'isPermissionDialogShown') {
      //Do something here
    }
});

`

solved by writing this code

baranacikgoz avatar Mar 05 '22 15:03 baranacikgoz

My code used to work like this, but it doesn't work now because it never run the setMethodCallHandler function. @umair13adil maybe you can look that.

    print('HELLO');
    if (Platform.isAndroid) {
      //Prominent disclosure
      print('HELLO ANDROID');
      await BeaconsPlugin.setDisclosureDialogMessage(
              title: "Arka Plan İzni",
              message:
                  "MyMessage")
          .then((value) {
        print('HELLO ANDROID 2');
      });
      await BeaconsPlugin.clearDisclosureDialogShowFlag(false);
      BeaconsPlugin.channel.setMethodCallHandler((call) async {
        print("Method: ${call.method}");
        if (call.method == 'scannerReady') {
          await BeaconsPlugin.startMonitoring();
        }
      });
    } else if (Platform.isIOS) {
      await BeaconsPlugin.startMonitoring();
    }

and that's my prints

I/flutter (22731): HELLO I/flutter (22731): HELLO ANDROID I/flutter (22731): HELLO ANDROID 2

barangungor avatar Mar 07 '22 13:03 barangungor