diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml
index 6e07bf5154..10f4c3c055 100644
--- a/android/res/values-ru/strings.xml
+++ b/android/res/values-ru/strings.xml
@@ -202,4 +202,6 @@
Показывать на карте
Закладки доступны в полной верии MapsWithMe. Скачать ее прямо сейчас?
+
+ GPS выключена в настройках устройства. Пожалуйста, включите ее для удобного использования программы.
diff --git a/android/res/values-uk/strings.xml b/android/res/values-uk/strings.xml
index 0749e25627..d7aebc446d 100644
--- a/android/res/values-uk/strings.xml
+++ b/android/res/values-uk/strings.xml
@@ -190,4 +190,6 @@
Показувати
Закладки доступні у повній версії MapsWithMe. Отримати просто зараз?
+
+ GPS вимкнена в налаштуваннях пристрою. Будь ласка, увімкніть її для зручного використання програми.
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index 7337636850..e3acbd640d 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -206,4 +206,6 @@
Visible
Bookmarks are available in the full version of MapsWithMe. Get it right now?
+
+ You currently have GPS for this device or application disabled. Please enable it in Settings.
diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java
index f82564ab6f..e9d23db028 100644
--- a/android/src/com/mapswithme/maps/MWMActivity.java
+++ b/android/src/com/mapswithme/maps/MWMActivity.java
@@ -21,6 +21,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
+import android.widget.Toast;
import com.mapswithme.maps.location.LocationService;
import com.mapswithme.util.ConnectionState;
@@ -626,6 +627,10 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
}).show();
}
}
+ else if (errorCode == LocationService.ERROR_GPS_OFF)
+ {
+ Toast.makeText(this, R.string.gps_is_disabled_long_text, Toast.LENGTH_LONG).show();
+ }
}
public void onCompassStatusChanged(int newStatus)
diff --git a/android/src/com/mapswithme/maps/location/LocationService.java b/android/src/com/mapswithme/maps/location/LocationService.java
index d24284320e..d1cd60ffe3 100644
--- a/android/src/com/mapswithme/maps/location/LocationService.java
+++ b/android/src/com/mapswithme/maps/location/LocationService.java
@@ -117,19 +117,27 @@ public class LocationService implements LocationListener, SensorEventListener, W
if (!m_isActive)
{
- List enabledProviders = m_locationManager.getProviders(true);
+ List providers = m_locationManager.getProviders(false);
- // Remove passive provider, we don't use it in the current implementation
- for (int i = 0; i < enabledProviders.size(); ++i)
- if (enabledProviders.get(i).equals("passive"))
+ // Remove passive provider and check for enabled providers.
+ boolean isGPSOff = false;
+ for (int i = 0; i < providers.size();)
+ {
+ final String provider = providers.get(i);
+ if (!m_locationManager.isProviderEnabled(provider) ||
+ provider.equals(LocationManager.PASSIVE_PROVIDER))
{
- enabledProviders.remove(i);
- break;
+ if (provider.equals(LocationManager.GPS_PROVIDER))
+ isGPSOff = true;
+ providers.remove(i);
}
+ else
+ ++i;
+ }
- Log.d(TAG, "Enabled providers count = " + enabledProviders.size());
+ Log.d(TAG, "Enabled providers count = " + providers.size());
- if (enabledProviders.size() == 0)
+ if (providers.size() == 0)
{
// Use WiFi BSSIDS and Google Internet location service if no other options are available
// But only if connection is available
@@ -149,17 +157,14 @@ public class LocationService implements LocationListener, SensorEventListener, W
Location lastKnown = null;
- for (String provider : enabledProviders)
+ for (String provider : providers)
{
- if (m_locationManager.isProviderEnabled(provider))
- {
- Log.d(TAG, "Connected to provider = " + provider);
- // Half of a second is more than enough, I think ...
- m_locationManager.requestLocationUpdates(provider, 500, 0, this);
+ Log.d(TAG, "Connected to provider = " + provider);
+ // Half of a second is more than enough, I think ...
+ m_locationManager.requestLocationUpdates(provider, 500, 0, this);
- // Remember last known location
- lastKnown = getBestLastKnownLocation(lastKnown, m_locationManager.getLastKnownLocation(provider));
- }
+ // Remember last known location
+ lastKnown = getBestLastKnownLocation(lastKnown, m_locationManager.getLastKnownLocation(provider));
}
if (m_sensorManager != null)
@@ -181,6 +186,9 @@ public class LocationService implements LocationListener, SensorEventListener, W
onLocationChanged(lastKnown);
}
}
+
+ if (isGPSOff)
+ observer.onLocationError(ERROR_GPS_OFF);
}
}
diff --git a/iphone/Maps/de.lproj/Localizable.strings b/iphone/Maps/de.lproj/Localizable.strings
index f304fbc30c..69b10220eb 100644
--- a/iphone/Maps/de.lproj/Localizable.strings
+++ b/iphone/Maps/de.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Lesezeichen stehen in der Vollversion von MapsWithMe zur Verfügung. Jetzt sofort besorgen?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/en.lproj/Localizable.strings b/iphone/Maps/en.lproj/Localizable.strings
index 622b834553..25c68c8835 100644
--- a/iphone/Maps/en.lproj/Localizable.strings
+++ b/iphone/Maps/en.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Bookmarks are available in the full version of MapsWithMe. Get it right now?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/es.lproj/Localizable.strings b/iphone/Maps/es.lproj/Localizable.strings
index c6aa922d73..f28e77cf4e 100644
--- a/iphone/Maps/es.lproj/Localizable.strings
+++ b/iphone/Maps/es.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "La opción de marcadores está disponible en la versión completa de MapsWithMe. ¿La quieres ya?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/fr.lproj/Localizable.strings b/iphone/Maps/fr.lproj/Localizable.strings
index 269c8ac21d..0f18d55342 100644
--- a/iphone/Maps/fr.lproj/Localizable.strings
+++ b/iphone/Maps/fr.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Les marques-page sont disponibles dans la version complète de MapsWithMe. Se la procurer maintenant?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/it.lproj/Localizable.strings b/iphone/Maps/it.lproj/Localizable.strings
index a2962deddd..a2a93384cb 100644
--- a/iphone/Maps/it.lproj/Localizable.strings
+++ b/iphone/Maps/it.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Bookmarks are available in the full version of MapsWithMe. Get it right now?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/ja.lproj/Localizable.strings b/iphone/Maps/ja.lproj/Localizable.strings
index 7b3dd3ac4d..96c6de2fcf 100644
--- a/iphone/Maps/ja.lproj/Localizable.strings
+++ b/iphone/Maps/ja.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "ブックマークはMapsWithMeの完全版でご利用いただけます。いますぐ取得されますか?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/ko.lproj/Localizable.strings b/iphone/Maps/ko.lproj/Localizable.strings
index 6ed535021f..5f6e759dd6 100644
--- a/iphone/Maps/ko.lproj/Localizable.strings
+++ b/iphone/Maps/ko.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "MapsWithMe의 정식 버전에서는 즐겨찾기를 이용하실 수 있습니다. 지금 바로 구입하시겠습니까?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/nl.lproj/Localizable.strings b/iphone/Maps/nl.lproj/Localizable.strings
index e32f122560..422175501b 100644
--- a/iphone/Maps/nl.lproj/Localizable.strings
+++ b/iphone/Maps/nl.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Bladwijzers zijn beschikbaar in de volledige versie van MapsWithMe. Wilt u die nu gelijk?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "You currently have GPS for this device or application disabled. Please enable it in Settings.";
diff --git a/iphone/Maps/ru.lproj/Localizable.strings b/iphone/Maps/ru.lproj/Localizable.strings
index af24393669..ac14ec20ac 100644
--- a/iphone/Maps/ru.lproj/Localizable.strings
+++ b/iphone/Maps/ru.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Закладки доступны в полной верии MapsWithMe. Скачать ее прямо сейчас?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "GPS выключена в настройках устройства. Пожалуйста, включите ее для удобного использования программы.";
diff --git a/iphone/Maps/uk.lproj/Localizable.strings b/iphone/Maps/uk.lproj/Localizable.strings
index 213596a46f..c60d3ada39 100644
--- a/iphone/Maps/uk.lproj/Localizable.strings
+++ b/iphone/Maps/uk.lproj/Localizable.strings
@@ -320,3 +320,6 @@
/* Proposal to download Pro version with Bookmarks */
"bookmarks_in_pro_version" = "Закладки доступні у повній версії MapsWithMe. Отримати просто зараз?";
+
+/* GPS are disabled by user alert - message */
+"gps_is_disabled_long_text" = "GPS вимкнена в налаштуваннях пристрою. Будь ласка, увімкніть її для зручного використання програми.";
diff --git a/strings.txt b/strings.txt
index 9bfd9d7313..41936a5b18 100644
--- a/strings.txt
+++ b/strings.txt
@@ -1308,3 +1308,8 @@
ko = MapsWithMe의 정식 버전에서는 즐겨찾기를 이용하실 수 있습니다. 지금 바로 구입하시겠습니까?
cs = V plné verzi MapsWithMe jsou k dispozici záložky. Chcete ji pořídit hned teď?
nl = Bladwijzers zijn beschikbaar in de volledige versie van MapsWithMe. Wilt u die nu gelijk?
+ [gps_is_disabled_long_text]
+ en = You currently have GPS for this device or application disabled. Please enable it in Settings.
+ comment = GPS are disabled by user alert - message
+ ru = GPS выключена в настройках устройства. Пожалуйста, включите ее для удобного использования программы.
+ uk = GPS вимкнена в налаштуваннях пристрою. Будь ласка, увімкніть її для зручного використання програми.