Nextrek
Diff Revisions
542
vs
546
for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Manager/MyLocation.java
|
@@ -30,7 +30,7 @@ |
30 |
30 |
|
static boolean gps_enabled = false; |
31 |
31 |
|
static boolean network_enabled = false; |
32 |
32 |
|
static boolean passive_enabled = false; |
33 |
|
- |
static boolean first =true; |
|
33 |
+ |
static int countGps =0; |
34 |
34 |
|
/** |
35 |
35 |
|
* Check if gps is enabled, show a toast when disabled |
36 |
36 |
|
* |
|
@@ -40,16 +40,15 @@ |
40 |
40 |
|
public static boolean isGpsEnabled(final Context context){ |
41 |
41 |
|
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); |
42 |
42 |
|
Boolean isGpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); |
43 |
|
- |
if(isGpsEnabled) |
|
43 |
+ |
if(!isGpsEnabled) |
44 |
44 |
|
{ |
45 |
|
- |
|
46 |
|
- |
}else{ |
47 |
45 |
|
Utils.toast(context, R.string.enable_gps_toast); |
48 |
|
- |
if (first==true) |
49 |
|
- |
first=false; |
50 |
|
- |
else |
|
46 |
+ |
if (countGps==0) |
|
47 |
+ |
countGps++; |
|
48 |
+ |
else if(countGps==1) |
51 |
49 |
|
{ |
52 |
|
- |
final int interval = 2000; |
|
50 |
+ |
countGps++; |
|
51 |
+ |
/*final int interval = 2000; |
53 |
52 |
|
Handler handler = new Handler(); |
54 |
53 |
|
Runnable runnable = new Runnable(){ |
55 |
54 |
|
public void run() { |
|
@@ -59,8 +58,8 @@ |
59 |
58 |
|
} |
60 |
59 |
|
}; |
61 |
60 |
|
handler.postDelayed(runnable, interval); |
62 |
|
- |
|
63 |
|
- |
} |
|
61 |
+ |
*/ |
|
62 |
+ |
} |
64 |
63 |
|
|
65 |
64 |
|
} |
66 |
65 |
|
|