Home > Blockchain >  how to update location when app in background flutter
how to update location when app in background flutter

Time:02-17

Please let me know how i can get longitude and latitude from carp_background_location.

I just get this data in terminal.

sendLocationEvent {callback=5839465806, location={altitude=78.0, heading=67.55118, latitude=30.2145618, accuracy=9.648, speed_accuracy=0.16278821, time=1.645010177E12, is_mocked=false, speed=0.0027909183, longitude=71.4721748}}

CodePudding user response:

You can get the location of the user but google will prevent you to do that because of "privacy and policy rules", but it will be a battery drainer application. Apps like uber , they use GPS while the app still running in the background

CodePudding user response:

If you just want it to be fetched when the app is in the background (not killed state) then you can simply use Timer.periodic() and as the callback function, you can pass the function to fetch location.

However, it also depends on the OS when to kill the app. For example, if your app is consuming a lot of resources, OS can kill your app.

CodePudding user response:

geolocator: ^8.2.0

this package can get a location in background just add permissions

  • Related