I am learning Flutter and trying to rebuild Clima project following londonappbrewery's flutter course. After I installed the geolocator package and invoked the getCurrentPosition method, I got nothing.
The geolocator version is ^9.0.2 with flutter 3.10.6 and I'm testing on a physical device.
void getLocation() async {
LocationPermission permission = await Geolocator.requestPermission();
print(permission);
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
print(position);
}
I manually asked permission from the device, but it's still not working.
This is what I add to the AndroidManifest.xml file:
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />