Nextrek
Diff Revisions
761
vs
762
for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Manager/MyLocation.java
|
@@ -39,12 +39,12 @@ |
39 |
39 |
|
* @param context context (this in Activity / getActivity() in Fragment) |
40 |
40 |
|
* @return true if gps is enabled |
41 |
41 |
|
*/ |
42 |
|
- |
public static boolean isGpsEnabled(final Context context) { |
|
42 |
+ |
public static boolean isGpsEnabled(final Context context,boolean showToast) { |
43 |
43 |
|
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); |
44 |
44 |
|
Boolean isGpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); |
45 |
45 |
|
if (!isGpsEnabled) { |
46 |
46 |
|
if(!gpsToastShownOnce){ |
47 |
|
- |
Utils.toast(context, R.string.enable_gps_toast); |
|
47 |
+ |
if (showToast) Utils.toast(context, R.string.enable_gps_toast); |
48 |
48 |
|
gpsToastShownOnce = true; |
49 |
49 |
|
} |
50 |
50 |
|
if (countGps == 0) |
|
@@ -111,7 +111,7 @@ |
111 |
111 |
|
|
112 |
112 |
|
public static boolean getLocation(Context context, LocationResult result) { |
113 |
113 |
|
|
114 |
|
- |
isGpsEnabled(context); |
|
114 |
+ |
isGpsEnabled(context,true); |
115 |
115 |
|
if (mylocation == null) { |
116 |
116 |
|
//I use LocationResult callback class to pass location value from MyLocation to user code. |
117 |
117 |
|
locationResult = result; |