Flutter local notifications triggered by GPS location
You can use Geolocator package: Geolocator
First save your currentLocation using getCurrentPosition
method.
It has getPositionStream
method which gives you new position whenever our position changes.
Whenever location change use distanceBetween
method to find the distance between them. The method returns the distance in meteres.
Whenever distance gets more than 1000m trigger notification.
API reference for Geolocator: Geolocator API docs
bradmuzza
Updated on December 10, 2022Comments
-
bradmuzza over 1 year
QQ:I have set up local notifications in my flutter app that are triggered at a certain time. However, now I would also like to add notification for when the device is taken 1km within a certain local. Any help or direction would be helpful. I have spent countless hours searching for information and guidance but have found nothing. Maybe flutter doesn’t have this capability.
-
Tirth Patel about 5 yearsYou can use Android platform channel to use Context Awareness API
-