Commit ac7813ae by 韩倩倩

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

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