Hi as I wrote in the title how can I achieve this? I've got the location permission but can not turn the location on!
Method 1: Location Setting Popup within AppAdd this package by adding the following lines in your pubspec. yaml file. This code will show the following alert dialog within App. If the user presses the "OK" button, the GPS will get turned ON.
To use the Geolocator plugin on the web you need to be using Flutter 1.20 or higher. Flutter will automatically add the endorsed geolocator_web package to your application when you add the geolocator: ^6.2. 0 dependency to your pubspec.
It will open setting. so user can enable it. it is best practice as per my knowledge.
Install plugin :
https://pub.dartlang.org/packages/android_intent#-installing-tab-
Import in your dart :
import 'package:android_intent/android_intent.dart';
Add method :
void openLocationSetting() async {
final AndroidIntent intent = new AndroidIntent(
action: 'android.settings.LOCATION_SOURCE_SETTINGS',
);
await intent.launch();
}
Invoke it done...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With