Hello,
I use flutter_beacon for a connected tag for luggage project.
I attempt to push a local notification when the beacon device is out of range but it seems not work.
flutterBeacon.monitoring(regions).listen((result) async {
//get gps coordinates
Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.best);
if(position == null){
position = await Geolocator().getLastKnownPosition(desiredAccuracy: LocationAccuracy.best);
}
if(result.monitoringEventType == MonitoringEventType.didEnterRegion) {
//save to store with timestamp
Storage().storeValue(
"beacon_last_latitude", position.latitude.toString());
Storage().storeValue(
"beacon_last_longitude", position.longitude.toString());
Storage().storeValue("beacon_last_timestamp",
new DateTime.now().millisecondsSinceEpoch.toString());
prefix0.log("BEACON FOUND: " + position.latitude.toString() + " - " +
position.longitude.toString());
} else if(result.monitoringEventType == MonitoringEventType.didExitRegion) {
LocalNotification(BEACON_NOTIFICATION_CHANNEL, "Out of range", "Warning, your luggage is out of range.").send();
}
});
In this case, i'm sure the local notification work but is never fired when i go away from my beacon. Do you have any idea to correct this issue ? Perhaps i don't understand the MonitoringEventType.
Hello, I use flutter_beacon for a connected tag for luggage project. I attempt to push a local notification when the beacon device is out of range but it seems not work.
In this case, i'm sure the local notification work but is never fired when i go away from my beacon. Do you have any idea to correct this issue ? Perhaps i don't understand the MonitoringEventType.
Thanks in advance, Valentin