Skip to content

BUGS IOS cannot complete scanning in second try #108

Description

@eggyot

I try to find beacon and in first try to scanning it's work normal. after found beacon and I try to scanning again with same function, it's cannot complete and whenComplete is never execute

ADD NOTE
maybe because permission in ios cannot run twice like this post? Baseflow/flutter-permission-handler#752

List<Region> regions;
        flutterBeacon.initializeAndCheckScanning.whenComplete(() {
          regions = <Region>[];
          if (Platform.isIOS) {
            // iOS platform, at least set identifier and proximityUUID for region scanning
            regions.add(
                Region(identifier: 'BEACON', proximityUUID: proximityUUID));
          } else {
            // android platform, it can ranging out of beacon that filter all of Proximity UUID
            regions.add(Region(identifier: 'com.beacon'));
          }

          // to start ranging beacons
          _streamRanging =
              flutterBeacon.ranging(regions).listen((RangingResult result) {
            // result contains a region and list of beacons found
            // list can be empty if no matching beacons were found in range
            for (var element in result.beacons) {
              i++;
              print("minor:" +
                  element.minor.toString() +
                  ", major:" +
                  element.major.toString() +
                  ", proximityUUID:" +
                  element.proximityUUID.toString());
              if (element.proximityUUID.toString() == proximityUUID &&
                  element.major.toString() == major &&
                  element.minor.toString() == minor) {
                eventAbsen(eventId, eventName, locationName, uuid, wajibBeacon,
                    eventImages, imei);
                break;
                // flutterBeacon.ranging(regions).cancel();
              } else if (i > result.beacons.length) {
                beaconNotFound(index);
                break;
              }
            }
          });
        })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions