0

I have a problem with gps management in a flutter application.

I've seen in this answer:

Is GPS activated - Flutter

how I can check if a gps is active in a flutter app.

If is not active (GeolocationStatus.denied) how can I take with flutter a user to device settings for turn on gps?

Thank you.

ilBarra
  • 796
  • 1
  • 8
  • 25

1 Answers1

3

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...

Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52
  • This answer works great. But one issue i am facing once user enabled the GPS how can i run some function after that. Is there any way to it. – Roxx Jun 21 '20 at 17:31