Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
g4proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
g4proxy
Commits
fc157a75
Commit
fc157a75
authored
Apr 30, 2019
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate
parent
5cd0d967
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
MainActivity.java
app/src/main/java/com/virjar/g4proxy/MainActivity.java
+1
-7
DeviceMessageUtil.java
...main/java/com/virjar/g4proxy/utils/DeviceMessageUtil.java
+24
-5
No files found.
app/src/main/java/com/virjar/g4proxy/MainActivity.java
View file @
fc157a75
...
...
@@ -42,9 +42,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
Button
button
=
findViewById
(
R
.
id
.
btn_report
);
button
.
setOnClickListener
(
this
);
String
clientKey
=
Settings
.
System
.
getString
(
getContentResolver
(),
Settings
.
Secure
.
ANDROID_ID
);
textView
.
setText
(
"device: "
+
clientKey
+
"\n\n"
);
BDLocationUtils
bdLocationUtils
=
new
BDLocationUtils
(
this
);
//开启定位
...
...
@@ -78,10 +75,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
//待上传的设备信息:devicesMsg
JSONObject
deviceMsg
=
DeviceMessageUtil
.
getDeviceMessage
(
this
);
String
clientKey
=
Settings
.
System
.
getString
(
getContentResolver
(),
Settings
.
Secure
.
ANDROID_ID
);
String
text
=
"device: "
+
clientKey
+
"\n\n"
;
textView
.
setText
(
text
+
deviceMsg
);
textView
.
setText
(
deviceMsg
.
toString
());
Request
request
=
HttpClientUtils
.
postRequest
(
"http://taskcenter.beta.qunar.com/api/phone/report"
,
deviceMsg
);
...
...
app/src/main/java/com/virjar/g4proxy/utils/DeviceMessageUtil.java
View file @
fc157a75
...
...
@@ -17,6 +17,7 @@ import android.os.Bundle;
import
android.provider.Settings
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.google.common.collect.Lists
;
...
...
@@ -86,7 +87,7 @@ public class DeviceMessageUtil {
String
slaveInfo
=
getSlaveInfo
(
context
);
String
deviceId
;
switch
(
channel
){
switch
(
channel
)
{
case
0
:
deviceId
=
getSerialNumber
();
Log
.
e
(
DeviceMsg
,
"channel: "
+
channel
);
...
...
@@ -158,7 +159,7 @@ public class DeviceMessageUtil {
}
}
}
if
(
location
==
null
)
{
if
(
location
==
null
)
{
latAndLon
.
put
(
latitude
,
""
+
Const
.
LATITUDE
);
latAndLon
.
put
(
longitude
,
""
+
Const
.
LONGITUDE
);
}
...
...
@@ -167,7 +168,7 @@ public class DeviceMessageUtil {
Log
.
e
(
DeviceMsg
,
"Longitude: "
+
String
.
valueOf
(
location
.
getLongitude
()));
latAndLon
.
put
(
latitude
,
String
.
valueOf
(
location
.
getLatitude
()));
latAndLon
.
put
(
longitude
,
String
.
valueOf
(
location
.
getLongitude
()));
}
else
{
}
else
{
Log
.
e
(
DeviceMsg
,
"location is null"
);
}
return
latAndLon
;
...
...
@@ -358,7 +359,7 @@ public class DeviceMessageUtil {
if
(
firstLine
!=
null
)
{
slaveInfo
=
firstLine
.
split
(
","
)[
0
];
channel
=
Integer
.
valueOf
(
firstLine
.
split
(
","
)[
1
]);
}
else
{
}
else
{
Log
.
e
(
DeviceMsg
,
"slave_info.txt can not be parsed!"
);
}
return
slaveInfo
;
...
...
@@ -409,8 +410,26 @@ public class DeviceMessageUtil {
/**
* 获取手机android_id
*/
private
static
String
getAndroidID
(
Context
context
){
private
static
String
getAndroidID
(
Context
context
)
{
String
sandboxIdpath
=
"/sdcard/qb/android_id.txt"
;
String
firstLine
=
null
;
try
{
FileReader
fileReader
=
new
FileReader
(
sandboxIdpath
);
BufferedReader
br
=
new
BufferedReader
(
fileReader
,
8192
);
firstLine
=
br
.
readLine
();
br
.
close
();
if
(!
TextUtils
.
isEmpty
(
firstLine
))
{
return
firstLine
;
}
}
catch
(
Exception
e
)
{
Log
.
e
(
DeviceMsg
,
"Cannot find slave_info.txt !"
);
e
.
printStackTrace
();
}
String
slaveInfo
=
null
;
// 另一种获取方式
// DeviceInfoHolder.getCachedAndroidId(context)
return
Settings
.
System
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
ANDROID_ID
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment