gps_connectivity

Last updated:

0 purchases

gps_connectivity Image
gps_connectivity Images
Add to Cart

Description:

gps connectivity

gps_connectivity #
A Flutter plugin that checks whether GPS is ON or OFF, it can listen for GPS change.
Inspired by connectivity_plus plugin
Platform Support #
Only Android for now.
Usage #
Sample usage to check current GPS status:
import 'package:gps_connectivity/gps_connectivity.dart';

bool isGpsEnabled = await (GpsConnectivity().checkGpsConnectivity());
if (isGpsEnabled) {
// GPS is ON.
} else {
// GPS is OFF.
}
copied to clipboard
You can also listen for GPS state changes by subscribing to the stream
exposed by plugin:
import 'package:gps_connectivity/gps_connectivity.dart';

@override
initState() {
super.initState();

subscription = GpsConnectivity().onGpsConnectivityChanged.listen((bool result) {
// Got a new GPS status!
});
}

// Be sure to cancel subscription after you are done
@override
dispose() {
subscription.cancel();
super.dispose();
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.