forked from organicmaps/organicmaps
Recovering location usage on GPS switch on.
This commit is contained in:
parent
58c9b5e598
commit
0be00a4a30
3 changed files with 35 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
|||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_GPS"/>
|
||||
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
|
||||
|
@ -389,5 +390,13 @@
|
|||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name="com.mapswithme.maps.location.GPSCheck" >
|
||||
<intent-filter>
|
||||
<action android:name="android.location.PROVIDERS_CHANGED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
21
android/src/com/mapswithme/maps/location/GPSCheck.java
Normal file
21
android/src/com/mapswithme/maps/location/GPSCheck.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package com.mapswithme.maps.location;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.LocationManager;
|
||||
import android.util.Log;
|
||||
|
||||
public class GPSCheck extends BroadcastReceiver
|
||||
{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
LocationManager locationManager = (LocationManager) context.getSystemService(context.LOCATION_SERVICE);
|
||||
|
||||
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
|
||||
{
|
||||
LocationHelper.INSTANCE.addLocationListener();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -638,6 +638,11 @@ public enum LocationHelper
|
|||
addListener(mLocationListener, true);
|
||||
}
|
||||
|
||||
public void addLocationListener()
|
||||
{
|
||||
addListener(mLocationListener, true);
|
||||
}
|
||||
|
||||
private void compareWithPreviousCallback()
|
||||
{
|
||||
if (mPrevUiCallback != null)
|
||||
|
|
Loading…
Add table
Reference in a new issue