我正在Google地图中实施位置监听器,以便使用覆盖功能 onLocationChanged()
来更新当前位置;
清单
<permission
android:name="com.ccs.navigation.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.ccs.navigation.permission.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
通过
调用onLocationChangeListener
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String bestProvider = locationManager.getBestProvider(criteria, false);
this.locationManager.requestLocationUpdates(bestProvider, 0, 1, this);
但是当我尝试运行代码时,它会自动调用onProviderDisabled()
覆盖函数
的build.gradle
compile 'com.google.android.gms:play-services:7.5.0'
我不知道为什么要去onProviderDisabled
任何人都可以帮助我。