Question:im trying to use the geolocator package on flutter, ive read its documentation and accordingly inserted the codes
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
i stopped running the app and rerunned it. but it still says
E/flutter (10375): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: User denied permissions to access the device's location.
is there something im missing? any help appreciated
Answer:Since version 8.0.0 of the geolocator plugin, the implicit requesting of permissions when calling the
Geolocator.getPositionStream()methods have been removed. Starting from version 8.0.0 it is necessary to explicitly call the
Geolocator.requestPermission()method before calling the
The suggested flow looks something like this:
If you have better answer, please add a comment about this, thank you!