Commit ac7813ae by 韩倩倩

imsi获取不到 + 没连网的状态下上传定位失败

1 parent 42aa632f
...@@ -317,7 +317,7 @@ public class LocationService extends Service { ...@@ -317,7 +317,7 @@ public class LocationService extends Service {
mLocationClient.stopLocation(); mLocationClient.stopLocation();
} }
handleGpsRelease(); //handleGpsRelease();
mRequestLocationCount = 0; mRequestLocationCount = 0;
postLocationInfo(); postLocationInfo();
...@@ -415,6 +415,7 @@ public class LocationService extends Service { ...@@ -415,6 +415,7 @@ public class LocationService extends Service {
@Override @Override
public void onSuccess(String response) { public void onSuccess(String response) {
Log.d(TAG, "response:success");
JsonObject resp = new JsonParser().parse(response).getAsJsonObject(); JsonObject resp = new JsonParser().parse(response).getAsJsonObject();
int code = resp.get(PreferencesUtil.HENG_FENG_SERVER_CODE).getAsInt(); int code = resp.get(PreferencesUtil.HENG_FENG_SERVER_CODE).getAsInt();
String msg = resp.get(PreferencesUtil.HENG_FENG_SERVER_MSG).getAsString(); String msg = resp.get(PreferencesUtil.HENG_FENG_SERVER_MSG).getAsString();
...@@ -461,12 +462,14 @@ public class LocationService extends Service { ...@@ -461,12 +462,14 @@ public class LocationService extends Service {
Toast.makeText(LocationService.this, msg, Toast.LENGTH_SHORT).show(); Toast.makeText(LocationService.this, msg, Toast.LENGTH_SHORT).show();
}*/ }*/
handleGpsRelease();
alarmToSendBroadcastForNextStartService(); alarmToSendBroadcastForNextStartService();
} }
@Override @Override
public void onFailed(Exception e) { public void onFailed(Exception e) {
Log.d(TAG, "response:failed");
handleGpsRelease();
alarmToSendBroadcastForNextStartService(); alarmToSendBroadcastForNextStartService();
} }
}); });
......
...@@ -590,7 +590,6 @@ public class PhoneUtils { ...@@ -590,7 +590,6 @@ public class PhoneUtils {
boolean isSimInsert = false; boolean isSimInsert = false;
TelephonyManager tm = getTM(context,slotId); TelephonyManager tm = getTM(context,slotId);
if(tm != null) { if(tm != null) {
Log.d(TAG, "invoke is success");
isSimInsert = tm.hasIccCard(); isSimInsert = tm.hasIccCard();
} }
...@@ -616,7 +615,7 @@ public class PhoneUtils { ...@@ -616,7 +615,7 @@ public class PhoneUtils {
Method getSubscriberId = telephonyManagerClazz.getMethod("getSubscriberId", int.class); Method getSubscriberId = telephonyManagerClazz.getMethod("getSubscriberId", int.class);
imsi = (String) getSubscriberId.invoke(telephonyManager, subId); imsi = (String) getSubscriberId.invoke(telephonyManager, subId);
}else if (Build.VERSION.SDK_INT >= 19){ }else if (Build.VERSION.SDK_INT >= 19){
TelephonyManager tm = getTM(context,subId); TelephonyManager tm = getTM(context,0);
if(tm != null) { if(tm != null) {
imsi = tm.getSubscriberId(); imsi = tm.getSubscriberId();
} }
...@@ -634,7 +633,7 @@ public class PhoneUtils { ...@@ -634,7 +633,7 @@ public class PhoneUtils {
//if (imsi != null && imsi.length() > 5) { //if (imsi != null && imsi.length() > 5) {
// imsi = imsi.substring(0, 5); // imsi = imsi.substring(0, 5);
// } // }
if (imsi == null) { if (TextUtils.isEmpty(imsi) ) {
imsi = "0"; imsi = "0";
} }
return imsi; return imsi;
...@@ -709,7 +708,6 @@ public class PhoneUtils { ...@@ -709,7 +708,6 @@ public class PhoneUtils {
TelephonyManager tm = getTM(context,0); TelephonyManager tm = getTM(context,0);
if(tm != null) { if(tm != null) {
String deviceId = tm.getDeviceId(); String deviceId = tm.getDeviceId();
Log.d(TAG,"deviceId:"+deviceId);
if (deviceId != null) { if (deviceId != null) {
meid = deviceId; meid = deviceId;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!