Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
石璀亮
/
agenew_a16_sos
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ac7813ae
authored
Jan 06, 2020
by
韩倩倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imsi获取不到 + 没连网的状态下上传定位失败
1 parent
42aa632f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
app/src/main/java/com/toscl/location/hengfeng/LocationService.java
app/src/main/java/com/toscl/location/hengfeng/util/PhoneUtils.java
app/src/main/java/com/toscl/location/hengfeng/LocationService.java
View file @
ac7813a
...
...
@@ -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
();
}
});
...
...
app/src/main/java/com/toscl/location/hengfeng/util/PhoneUtils.java
View file @
ac7813a
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment