Subversion Repository Public Repository

Nextrek

Diff Revisions 599 vs 633 for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Manager/MyLocation.java

Diff revisions: vs.
  @@ -31,6 +31,8 @@
31 31 static boolean network_enabled = false;
32 32 static boolean passive_enabled = false;
33 33 static int countGps =0;
34 + private static boolean gpsToastShownOnce = false;
35 +
34 36 /**
35 37 * Check if gps is enabled, show a toast when disabled
36 38 *
  @@ -41,7 +43,10 @@
41 43 LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
42 44 Boolean isGpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
43 45 if (!isGpsEnabled) {
44 - Utils.toast(context, R.string.enable_gps_toast);
46 + if(!gpsToastShownOnce){
47 + Utils.toast(context, R.string.enable_gps_toast);
48 + gpsToastShownOnce = true;
49 + }
45 50 if (countGps == 0)
46 51 countGps++;
47 52 else if (countGps == 1) {