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
5a8b3ca0
Commit
5a8b3ca0
authored
Apr 30, 2019
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d78ac14e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
MainActivity.java
app/src/main/java/com/virjar/g4proxy/MainActivity.java
+2
-3
SchedulerTaskService.java
...java/com/virjar/g4proxy/service/SchedulerTaskService.java
+28
-9
No files found.
app/src/main/java/com/virjar/g4proxy/MainActivity.java
View file @
5a8b3ca0
...
...
@@ -78,13 +78,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
textView
.
setText
(
deviceMsg
.
toString
());
String
serverUrl
=
"https://hotelcrawl.qunar.com/api/phone/report"
;
textView
.
setText
(
serverUrl
);
textView
.
setText
(
SchedulerTaskService
.
msgReportlUrl
);
textView
.
append
(
"\r\n"
+
deviceMsg
);
// Request request = HttpClientUtils.postRequest("http://taskcenter.beta.qunar.com/api/phone/report", deviceMsg);
//https://hotelcrawl.qunar.com/api/phone/report
Request
request
=
HttpClientUtils
.
postRequest
(
"https://hotelcrawl.qunar.com/api/phone/report"
,
deviceMsg
);
Request
request
=
HttpClientUtils
.
postRequest
(
SchedulerTaskService
.
msgReportlUrl
,
deviceMsg
);
HttpClientUtils
.
getClient
().
newCall
(
request
).
enqueue
(
new
Callback
()
{
@Override
...
...
app/src/main/java/com/virjar/g4proxy/service/SchedulerTaskService.java
View file @
5a8b3ca0
package
com
.
virjar
.
g4proxy
.
service
;
import
android.app.Activity
;
import
android.app.AlarmManager
;
import
android.app.PendingIntent
;
import
android.app.Service
;
...
...
@@ -13,9 +14,12 @@ import android.os.Looper;
import
android.os.SystemClock
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.tencent.mm.R
;
import
com.virjar.g4proxy.Constant
;
import
com.virjar.g4proxy.MainActivity
;
import
com.virjar.g4proxy.utils.DeviceMessageUtil
;
import
com.virjar.g4proxy.utils.HttpClientUtils
;
...
...
@@ -28,6 +32,7 @@ import okhttp3.Call;
import
okhttp3.Callback
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
okhttp3.ResponseBody
;
import
top.wuhaojie.installerlibrary.AutoInstaller
;
import
static
com
.
virjar
.
g4proxy
.
Constant
.
schedulerTAG
;
...
...
@@ -40,7 +45,8 @@ public class SchedulerTaskService extends Service {
public
static
final
int
reportInterval
=
5
;
public
static
final
String
getNewestModifiedApkUrl
=
"http://www.scumall.com:5597/hermes/ModifiedApp/getNewestModifiedApk?appPackageName="
;
public
static
final
String
msgReportlUrl
=
"http://taskcenter.beta.qunar.com/api/phone/report"
;
//public static final String msgReportlUrl ="http://taskcenter.beta.qunar.com/api/phone/report"
public
static
final
String
msgReportlUrl
=
"https://hotelcrawl.qunar.com/api/phone/report"
;
private
long
lastCheckUpdateTimestamp
=
0
;
private
long
lastCheckReportTimestamp
=
0
;
...
...
@@ -73,20 +79,20 @@ public class SchedulerTaskService extends Service {
Log
.
e
(
schedulerTAG
,
"checkAndRunTask"
);
if
(
System
.
currentTimeMillis
()
-
lastCheckUpdateTimestamp
>
(
updateInterval
*
1000
*
60
)
/
3
)
{
runAppInstallTask
();
}
else
{
}
else
{
lastCheckUpdateTimestamp
=
System
.
currentTimeMillis
();
}
if
(
System
.
currentTimeMillis
()
-
lastCheckReportTimestamp
>
(
reportInterval
*
1000
*
60
)
/
3
){
runReportMessageTask
();
}
else
{
if
(
System
.
currentTimeMillis
()
-
lastCheckReportTimestamp
>
(
reportInterval
*
1000
*
60
)
/
3
)
{
runReportMessageTask
(
this
);
}
else
{
lastCheckReportTimestamp
=
System
.
currentTimeMillis
();
}
}
p
rivate
void
runReportMessageTask
(
)
{
p
ublic
static
void
runReportMessageTask
(
final
Context
context
)
{
Log
.
e
(
schedulerTAG
,
"runUploadMessageTask"
);
JSONObject
deviceMessage
=
DeviceMessageUtil
.
getDeviceMessage
(
this
);
JSONObject
deviceMessage
=
DeviceMessageUtil
.
getDeviceMessage
(
context
);
Request
request
=
HttpClientUtils
.
postRequest
(
msgReportlUrl
,
deviceMessage
);
...
...
@@ -100,9 +106,22 @@ public class SchedulerTaskService extends Service {
public
void
onResponse
(
@javax
.
annotation
.
Nullable
Call
call
,
@javax
.
annotation
.
Nullable
Response
response
)
{
try
{
if
(
response
!=
null
)
{
Log
.
e
(
"report response"
,
response
.
body
().
string
());
}
ResponseBody
body
=
response
.
body
();
if
(
body
!=
null
)
{
final
String
responseStr
=
body
.
string
();
if
(
context
instanceof
MainActivity
)
{
((
MainActivity
)
context
).
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
TextView
textView
=
((
MainActivity
)
context
).
findViewById
(
R
.
id
.
text
);
textView
.
append
(
"\r\n"
+
responseStr
);
}
});
}
Log
.
e
(
"report response"
,
responseStr
);
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
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