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
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;
}
}
});
})
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 executeADD NOTE maybe because permission in ios cannot run twice like this post? https://github.com/Baseflow/flutter-permission-handler/issues/752