找了一圈pub沒找著澡屡,
只看到個location冒窍,但get之后需要google 服務(wù)拢肆,沒安裝一直彈窗……
那就自己寫一下吧
git地址:
https://github.com/EchoPuda/location_service_check.git
nullsafety版本:https://github.com/EchoPuda/location_service_check_nullsafety
pub:https://pub.dev/packages/location_service_check
使用方法
pubspec.yaml:
location_service_check:
git:
url: https://github.com/EchoPuda/location_service_check.git
import
import 'package:location_service_check/location_service_check.dart';
檢查是否開啟了定位服務(wù)
bool open = await LocationServiceCheck.checkLocationIsOpen;
打開定位設(shè)置頁
await LocationServiceCheck.openLocationSetting;
Android直接打開系統(tǒng)的定位服務(wù), iOS由于ios10開始不支持打開系統(tǒng)詳細設(shè)置,所以打開應(yīng)用的設(shè)置頁搂誉。