Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-09-21 16:04:21 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:43:44 +0300
commit8a88a6672024e4cf2696427756919c30f7701a7f (patch)
tree30868a766a4656c45f8e1805dd701f3123e6e4b6 /android/src/com/mapswithme
parent7034fdfdb93488ca46e48fa6bd5775c9fc941a91 (diff)
[android] Skip China in checkFacebookDialog().
Diffstat (limited to 'android/src/com/mapswithme')
-rw-r--r--android/src/com/mapswithme/maps/MWMActivity.java31
-rw-r--r--android/src/com/mapswithme/maps/MWMApplication.java2
-rw-r--r--android/src/com/mapswithme/maps/location/LocationService.java2
3 files changed, 33 insertions, 2 deletions
diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java
index 843cb5bb6e..d24d49e8ce 100644
--- a/android/src/com/mapswithme/maps/MWMActivity.java
+++ b/android/src/com/mapswithme/maps/MWMActivity.java
@@ -9,10 +9,13 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
+import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
+import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -276,10 +279,34 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
startActivity(intent);
}
+ private boolean isChinaRegion()
+ {
+ final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+ if (tm != null && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA)
+ {
+ final String iso = tm.getNetworkCountryIso();
+ Log.i(TAG, "TelephonyManager country IOS = " + iso);
+
+ String arr[] = { "CN", "CHN", "HK", "HKG", "MO", "MAC" };
+ for (String s : arr)
+ if (iso.equalsIgnoreCase(s))
+ return true;
+ }
+ else
+ {
+ final Location l = mApplication.getLocationService().getLastKnown();
+ if (l != null && nativeIsInChina(l.getLatitude(), l.getLongitude()))
+ return true;
+ }
+
+ return false;
+ }
+
private void checkFacebookDialog()
{
if ((ConnectionState.getState(this) != ConnectionState.NOT_CONNECTED) &&
- mApplication.nativeShouldShowFacebookDialog())
+ mApplication.nativeShouldShowFacebookDialog() &&
+ !isChinaRegion())
{
new AlertDialog.Builder(this)
.setCancelable(false)
@@ -734,4 +761,6 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
private native String nativeGetProVersionURL();
private native void nativeCheckForProVersion(String serverURL);
+
+ private native boolean nativeIsInChina(double lat, double lon);
}
diff --git a/android/src/com/mapswithme/maps/MWMApplication.java b/android/src/com/mapswithme/maps/MWMApplication.java
index 9e7f806fbc..ca410100cc 100644
--- a/android/src/com/mapswithme/maps/MWMApplication.java
+++ b/android/src/com/mapswithme/maps/MWMApplication.java
@@ -160,7 +160,7 @@ public class MWMApplication extends android.app.Application implements MapStorag
{
return getFilesDir().getAbsolutePath() + "/";
}
- */
+ */
static
{
diff --git a/android/src/com/mapswithme/maps/location/LocationService.java b/android/src/com/mapswithme/maps/location/LocationService.java
index 11b64cd080..78be1aedd0 100644
--- a/android/src/com/mapswithme/maps/location/LocationService.java
+++ b/android/src/com/mapswithme/maps/location/LocationService.java
@@ -74,6 +74,8 @@ public class LocationService implements LocationListener, SensorEventListener, W
}
}
+ public Location getLastKnown() { return m_lastLocation; }
+
private void notifyStatusChanged(int newStatus)
{
Iterator<Listener> it = m_observers.iterator();