Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李雅为
/
wechat_click
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8679180c
authored
Apr 04, 2018
by
jeffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改返回方式 把日志上传服务器
parent
631b161e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
44 deletions
+126
-44
app/build.gradle
+2
-2
app/src/main/java/com/xf/weixinclick/NewService.java
+110
-42
app/src/main/java/com/xf/weixinclick/http/ClientApi.java
+2
-0
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
+12
-0
No files found.
app/build.gradle
View file @
8679180c
...
@@ -22,8 +22,8 @@ android {
...
@@ -22,8 +22,8 @@ android {
applicationId
"com.xf.weixinclick"
applicationId
"com.xf.weixinclick"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
25
targetSdkVersion
25
versionCode
6
versionCode
7
versionName
"1.5.
2
"
versionName
"1.5.
3
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild
{
externalNativeBuild
{
cmake
{
cmake
{
...
...
app/src/main/java/com/xf/weixinclick/NewService.java
View file @
8679180c
...
@@ -23,7 +23,6 @@ import com.xf.weixinclick.bean.msg.ReceiverMsg;
...
@@ -23,7 +23,6 @@ import com.xf.weixinclick.bean.msg.ReceiverMsg;
import
com.xf.weixinclick.http.HttpClientApi
;
import
com.xf.weixinclick.http.HttpClientApi
;
import
com.xf.weixinclick.http.HttpSubscriber
;
import
com.xf.weixinclick.http.HttpSubscriber
;
import
com.xf.weixinclick.receiver.WeChatStatus
;
import
com.xf.weixinclick.receiver.WeChatStatus
;
import
com.xf.weixinclick.utils.NotificationUtils
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
org.greenrobot.eventbus.Subscribe
;
...
@@ -61,8 +60,8 @@ public class NewService extends AccessibilityService {
...
@@ -61,8 +60,8 @@ public class NewService extends AccessibilityService {
private
final
static
String
MM_PNAME
=
"com.tencent.mm"
;
private
final
static
String
MM_PNAME
=
"com.tencent.mm"
;
public
static
final
String
PARAMS_MSG
=
"msg"
;
public
static
final
String
PARAMS_MSG
=
"msg"
;
int
isSuccess
=
1
;
int
ACTION_SUCCESS
=
1
;
int
isFalse
=
0
;
int
ACTION_FAIL
=
0
;
// private String Url = "https://weapp-dev.wangjia.com/qr.jpg?dd=1";
// private String Url = "https://weapp-dev.wangjia.com/qr.jpg?dd=1";
...
@@ -78,6 +77,12 @@ public class NewService extends AccessibilityService {
...
@@ -78,6 +77,12 @@ public class NewService extends AccessibilityService {
long
lastShowToastTime
;
long
lastShowToastTime
;
/**
* 因为首次进来的时候检测到不是首页的时候也会返回,所以用step的话不准确,要单独弄个变量出来
*/
private
boolean
inBacking
=
false
;
private
int
actionResult
=
ACTION_FAIL
;
...
@@ -105,24 +110,22 @@ public class NewService extends AccessibilityService {
...
@@ -105,24 +110,22 @@ public class NewService extends AccessibilityService {
@Subscribe
@Subscribe
public
void
receiverMsg
(
final
ReceiverMsg
msg
)
{
public
void
receiverMsg
(
final
ReceiverMsg
msg
)
{
Log
.
d
(
TAG
,
"receiverMsg"
);
logToastAndUploa
d
(
TAG
,
"receiverMsg"
);
delayBean
=
msg
.
getTime_config
();
delayBean
=
msg
.
getTime_config
();
if
(
delayBean
==
null
){
if
(
delayBean
==
null
){
Log
.
d
(
TAG
,
"delayBean 是空"
);
logToastAndUploa
d
(
TAG
,
"delayBean 是空"
);
}
}
if
(
step
!=
0
&&
taskMsg
!=
null
){
if
(
step
!=
0
&&
taskMsg
!=
null
){
long
haveRunTime
=
System
.
currentTimeMillis
()/
1000
-
taskMsg
.
getPushed_at
();
long
haveRunTime
=
System
.
currentTimeMillis
()/
1000
-
taskMsg
.
getPushed_at
();
if
(
haveRunTime
<
20
){
if
(
haveRunTime
<
20
){
Log
.
d
(
TAG
,
"前还有任务在执行,什么都不做"
);
logToastAndUpload
(
TAG
,
"前还有任务在执行,什么都不做"
);
showToast
(
getApplicationContext
(),
"当前还有任务在执行,什么都不做"
);
return
;
return
;
}
}
if
(
haveRunTime
>
40
){
if
(
haveRunTime
>
40
){
Log
.
d
(
TAG
,
"之前任务超过40秒,清除并开始新任务"
);
logToastAndUpload
(
TAG
,
"之前任务超过40秒,清除并开始新任务"
);
showToast
(
getApplicationContext
(),
"之前任务超过40秒,清除并开始新任务"
);
resetAll
();
resetAll
();
}
}
}
}
...
@@ -131,10 +134,10 @@ public class NewService extends AccessibilityService {
...
@@ -131,10 +134,10 @@ public class NewService extends AccessibilityService {
delayDeal
(
delayBean
.
getAfter_open_weixin_file_helper_delay
(),
new
IDelayMethord
()
{
delayDeal
(
delayBean
.
getAfter_open_weixin_file_helper_delay
(),
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
Log
.
d
(
TAG
,
"receiverMsg里面触发下页面消息 unique_id "
+
msg
.
getUnique_id
());
logToastAndUploa
d
(
TAG
,
"receiverMsg里面触发下页面消息 unique_id "
+
msg
.
getUnique_id
());
WeChatStatus
.
receiverMsg
();
WeChatStatus
.
receiverMsg
();
String
Url
=
msg
.
getQr_addr
();
//
String Url = msg.getQr_addr();
Log
.
d
(
TAG
,
"receiverMsg里面触发下页面消息 Url "
+
Url
);
//
Log.d(TAG, "receiverMsg里面触发下页面消息 Url " + Url);
message_id
=
msg
.
getUnique_id
();
message_id
=
msg
.
getUnique_id
();
taskMsg
=
msg
;
taskMsg
=
msg
;
step
=
0
;
step
=
0
;
...
@@ -157,28 +160,48 @@ public class NewService extends AccessibilityService {
...
@@ -157,28 +160,48 @@ public class NewService extends AccessibilityService {
}
}
int
eventType
=
event
.
getEventType
();
int
eventType
=
event
.
getEventType
();
String
className
=
event
.
getClassName
().
toString
();
String
className
=
event
.
getClassName
().
toString
();
Log
.
d
(
TAG
,
"get event = "
+
eventType
+
" class "
+
className
+
" step "
+
step
);
logToastAndUploa
d
(
TAG
,
"get event = "
+
eventType
+
" class "
+
className
+
" step "
+
step
);
long
currentTime
=
System
.
currentTimeMillis
();
long
currentTime
=
System
.
currentTimeMillis
();
if
(
currentTime
-
lastShowToastTime
>
10
*
1000
){
if
(
currentTime
-
lastShowToastTime
>
10
*
1000
){
boolean
taskMsgExist
=
taskMsg
==
null
;
boolean
taskMsgExist
=
taskMsg
==
null
;
String
taskMsgPrompt
=
taskMsgExist
?
"消息是空"
:
"消息存在"
;
String
taskMsgPrompt
=
taskMsgExist
?
"消息是空"
:
"消息存在"
;
showToast
(
getApplicationContext
()
,
"辅助service还活着 step = "
+
step
+
" "
+
taskMsgPrompt
);
logToastAndUpload
(
TAG
,
"辅助service还活着 step = "
+
step
+
" "
+
taskMsgPrompt
);
lastShowToastTime
=
currentTime
;
lastShowToastTime
=
currentTime
;
}
}
if
(!
className
.
contains
(
MM_PNAME
))
{
if
(!
className
.
contains
(
MM_PNAME
))
{
return
;
return
;
}
}
if
(
inBacking
){
logToastAndUpload
(
TAG
,
"执行返回中"
);
// showToast(getApplicationContext(),"执行返回中");
//都是点击左上角
execShellCmd
(
"input tap "
+
dip2px
(
20
)
+
" "
+
dip2px
(
50
));
if
(
className
.
equals
(
WeChatUi
)){
//到了首页就结束
inBacking
=
false
;
logToastAndUpload
(
TAG
,
"执行返回完成"
);
// showToast(getApplicationContext(),"执行返回完成");
upResult
(
actionResult
,
message_id
);
}
return
;
}
if
(
taskMsg
==
null
){
if
(
taskMsg
==
null
){
Log
.
d
(
TAG
,
"NewService but taskMsg is null"
);
logToastAndUploa
d
(
TAG
,
"NewService but taskMsg is null"
);
return
;
return
;
}
}
if
(
step
==
0
&&
!
findNodeByTexts
(
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
if
(
step
==
0
&&
!
findNodeByTexts
(
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
Log
.
d
(
TAG
,
"当前页不是首页"
);
logToastAndUploa
d
(
TAG
,
"当前页不是首页"
);
showToast
(
getApplicationContext
(),
"当前页不是首页"
);
//
showToast(getApplicationContext(),"当前页不是首页");
turnBack
(
isFalse
,
1
);
turnBack
(
ACTION_FAIL
);
resetAll
();
resetAll
();
return
;
return
;
}
}
...
@@ -192,15 +215,17 @@ public class NewService extends AccessibilityService {
...
@@ -192,15 +215,17 @@ public class NewService extends AccessibilityService {
// Log.d(TAG, "是在第一步,但不是在首页,重新进入再来");
// Log.d(TAG, "是在第一步,但不是在首页,重新进入再来");
// resetAll();
// resetAll();
// showToast(getApplicationContext(),"当前页不是首页");
// showToast(getApplicationContext(),"当前页不是首页");
// turnBack(
isFalse
,2);
// turnBack(
ACTION_FAIL
,2);
// }
// }
if
(
step
==
0
&&
findNodeByTexts
(
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
if
(
step
==
0
&&
findNodeByTexts
(
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
//点击文件传输助手的位置
//点击文件传输助手的位置
//最好还是找到文字然后点击位置
//最好还是找到文字然后点击位置
//没办法 首页打印出来的是通讯录的布局,所以坐标是错误的
//没办法 首页打印出来的是通讯录的布局,所以坐标是错误的
step
++;
step
++;
Log
.
d
(
TAG
,
"准备点击首页的文件传输助手"
);
logToastAndUploa
d
(
TAG
,
"准备点击首页的文件传输助手"
);
delayDeal
(
delayBean
.
getAfter_open_weixin_index_delay
(),
new
IDelayMethord
()
{
delayDeal
(
delayBean
.
getAfter_open_weixin_index_delay
(),
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
...
@@ -209,12 +234,12 @@ public class NewService extends AccessibilityService {
...
@@ -209,12 +234,12 @@ public class NewService extends AccessibilityService {
return
;
return
;
}
}
if
(!
findNodeByTexts
(
NewService
.
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
if
(!
findNodeByTexts
(
NewService
.
this
,
"微信"
,
"通讯录"
,
"发现"
,
"我"
)){
Log
.
d
(
TAG
,
"不在首页
,不点击"
);
logToastAndUpload
(
TAG
,
"没有发现文件传输助手
,不点击"
);
showToast
(
myApplication
.
getInstence
(),
"没有发现文件传输助手,不点击"
);
//
showToast(myApplication.getInstence(),"没有发现文件传输助手,不点击");
return
;
return
;
}
}
Log
.
d
(
TAG
,
"开始点击首页的文件传输助手"
);
logToastAndUploa
d
(
TAG
,
"开始点击首页的文件传输助手"
);
printAllNode
();
printAllNode
();
execShellCmd
(
"input tap 220 200"
);
execShellCmd
(
"input tap 220 200"
);
step
++;
step
++;
...
@@ -231,28 +256,28 @@ public class NewService extends AccessibilityService {
...
@@ -231,28 +256,28 @@ public class NewService extends AccessibilityService {
// && findNodeByTexts(this,"文件传输助手")
// && findNodeByTexts(this,"文件传输助手")
if
(
step
==
2
&&
!
findNodeByTexts
(
this
,
"文件传输助手"
)){
if
(
step
==
2
&&
!
findNodeByTexts
(
this
,
"文件传输助手"
)){
resetAll
();
resetAll
();
showToast
(
getApplicationContext
()
,
"当前页不是文件传输助手页"
);
logToastAndUpload
(
TAG
,
"当前页不是文件传输助手页"
);
turnBack
(
isFalse
,
1
);
turnBack
(
ACTION_FAIL
);
return
;
return
;
}
}
if
(
step
==
2
&&
findNodeByTexts
(
this
,
"文件传输助手"
)){
if
(
step
==
2
&&
findNodeByTexts
(
this
,
"文件传输助手"
)){
step
++;
step
++;
Log
.
d
(
TAG
,
"文件传输详情页面_填充_准备"
);
logToastAndUploa
d
(
TAG
,
"文件传输详情页面_填充_准备"
);
delayDeal
(
5000
,
new
IDelayMethord
()
{
delayDeal
(
5000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
Log
.
d
(
TAG
,
"文件传输详情页面_填充"
);
logToastAndUploa
d
(
TAG
,
"文件传输详情页面_填充"
);
printAllNode
();
printAllNode
();
if
(
fill
()){
if
(
fill
()){
Log
.
d
(
TAG
,
"文件传输详情页面_填充_完成"
);
logToastAndUploa
d
(
TAG
,
"文件传输详情页面_填充_完成"
);
send
();
send
();
clickMsg
(
getRootInActiveWindow
());
clickMsg
(
getRootInActiveWindow
());
step
++;
step
++;
}
else
{
}
else
{
Log
.
d
(
TAG
,
"文件传输详情页面_填充_失败"
);
logToastAndUploa
d
(
TAG
,
"文件传输详情页面_填充_失败"
);
}
}
}
}
});
});
...
@@ -291,7 +316,7 @@ public class NewService extends AccessibilityService {
...
@@ -291,7 +316,7 @@ public class NewService extends AccessibilityService {
}
}
if
(
step
==
6
&&
className
.
equals
(
WeChatAlert
)){
if
(
step
==
6
&&
className
.
equals
(
WeChatAlert
)){
Log
.
d
(
TAG
,
"开始点击确认二维码"
);
logToastAndUploa
d
(
TAG
,
"开始点击确认二维码"
);
step
++;
step
++;
delayDeal
(
delayBean
.
getLong_press_qrcode_delay
(),
new
IDelayMethord
()
{
delayDeal
(
delayBean
.
getLong_press_qrcode_delay
(),
new
IDelayMethord
()
{
@Override
@Override
...
@@ -303,7 +328,7 @@ public class NewService extends AccessibilityService {
...
@@ -303,7 +328,7 @@ public class NewService extends AccessibilityService {
}
}
if
(
step
==
8
&&
className
.
equals
(
WeChatWebView
)){
if
(
step
==
8
&&
className
.
equals
(
WeChatWebView
)){
Log
.
d
(
TAG
,
"开始点击确认登录"
);
logToastAndUploa
d
(
TAG
,
"开始点击确认登录"
);
pressSure
();
pressSure
();
step
++;
step
++;
// resetAll();
// resetAll();
...
@@ -410,6 +435,10 @@ public class NewService extends AccessibilityService {
...
@@ -410,6 +435,10 @@ public class NewService extends AccessibilityService {
}
}
}
}
@Override
protected
boolean
onKeyEvent
(
KeyEvent
event
)
{
return
super
.
onKeyEvent
(
event
);
}
/**
/**
* 二维码长点击
* 二维码长点击
...
@@ -434,7 +463,7 @@ public class NewService extends AccessibilityService {
...
@@ -434,7 +463,7 @@ public class NewService extends AccessibilityService {
.
findAccessibilityNodeInfosByText
(
needClick
);
.
findAccessibilityNodeInfosByText
(
needClick
);
if
(
allData
.
isEmpty
())
{
if
(
allData
.
isEmpty
())
{
turnBack
(
isFalse
,
1
);
turnBack
(
ACTION_FAIL
);
}
else
{
}
else
{
for
(
AccessibilityNodeInfo
temp
:
allData
)
{
for
(
AccessibilityNodeInfo
temp
:
allData
)
{
Rect
rect
=
new
Rect
();
Rect
rect
=
new
Rect
();
...
@@ -471,7 +500,7 @@ public class NewService extends AccessibilityService {
...
@@ -471,7 +500,7 @@ public class NewService extends AccessibilityService {
}
}
if
(
findNode
==
null
)
{
if
(
findNode
==
null
)
{
Log
.
d
(
TAG
,
String
.
format
(
"没有根据文字找到确认"
));
logToastAndUploa
d
(
TAG
,
String
.
format
(
"没有根据文字找到确认"
));
int
delayTime
=
delayBean
.
getAfter_click_decode_button_delay
();
int
delayTime
=
delayBean
.
getAfter_click_decode_button_delay
();
delayDeal
(
delayTime
,
new
IDelayMethord
()
{
delayDeal
(
delayTime
,
new
IDelayMethord
()
{
...
@@ -507,10 +536,10 @@ public class NewService extends AccessibilityService {
...
@@ -507,10 +536,10 @@ public class NewService extends AccessibilityService {
}
}
});
});
}
else
{
}
else
{
Log
.
d
(
TAG
,
String
.
format
(
"根据文字找到确认了"
));
logToastAndUploa
d
(
TAG
,
String
.
format
(
"根据文字找到确认了"
));
final
AccessibilityNodeInfo
finalFindNode
=
findNode
;
final
AccessibilityNodeInfo
finalFindNode
=
findNode
;
delayDeal
(
5
000
,
new
IDelayMethord
()
{
delayDeal
(
2
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
Rect
rect
=
new
Rect
();
Rect
rect
=
new
Rect
();
...
@@ -520,7 +549,7 @@ public class NewService extends AccessibilityService {
...
@@ -520,7 +549,7 @@ public class NewService extends AccessibilityService {
}
}
});
});
delayDeal
(
7
000
,
new
IDelayMethord
()
{
delayDeal
(
3
000
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
...
@@ -572,12 +601,13 @@ public class NewService extends AccessibilityService {
...
@@ -572,12 +601,13 @@ public class NewService extends AccessibilityService {
*/
*/
void
isPassTime
()
{
void
isPassTime
()
{
try
{
try
{
List
<
AccessibilityNodeInfo
>
allData
=
getRootInActiveWindow
()
List
<
AccessibilityNodeInfo
>
allData
=
getRootInActiveWindow
()
.
findAccessibilityNodeInfosByText
(
needBack2
);
.
findAccessibilityNodeInfosByText
(
needBack2
);
if
(
allData
.
isEmpty
())
{
if
(
allData
.
isEmpty
())
{
Log
.
d
(
TAG
,
String
.
format
(
"回头了成功 没有确定按钮"
));
logToastAndUploa
d
(
TAG
,
String
.
format
(
"回头了成功 没有确定按钮"
));
turnBack
(
isSuccess
,
2
);
turnBack
(
ACTION_SUCCESS
);
}
else
{
}
else
{
for
(
AccessibilityNodeInfo
temp
:
allData
)
{
for
(
AccessibilityNodeInfo
temp
:
allData
)
{
Log
.
d
(
TAG
,
String
.
format
(
"回头了 有确定按钮 再点击下"
));
Log
.
d
(
TAG
,
String
.
format
(
"回头了 有确定按钮 再点击下"
));
...
@@ -590,16 +620,26 @@ public class NewService extends AccessibilityService {
...
@@ -590,16 +620,26 @@ public class NewService extends AccessibilityService {
delayDeal
(
800
,
new
IDelayMethord
()
{
delayDeal
(
800
,
new
IDelayMethord
()
{
@Override
@Override
public
void
delayMethord
()
{
public
void
delayMethord
()
{
turnBack
(
isFalse
,
2
);
turnBack
(
ACTION_FAIL
);
}
}
});
});
}
}
}
catch
(
Exception
ignored
)
{
}
catch
(
Exception
ignored
)
{
Log
.
d
(
TAG
,
"异常 "
+
ignored
.
getMessage
());
logToastAndUploa
d
(
TAG
,
"异常 "
+
ignored
.
getMessage
());
}
}
}
}
private
void
turnBack
(
int
code
){
Log
.
d
(
TAG
,
"执行返回"
+
code
+
"turnBack"
);
inBacking
=
true
;
//需要返回
execShellCmd
(
"input keyevent 4"
);
resetAll
();
// upResult(code,message_id);
}
/**
/**
* 返回
* 返回
*/
*/
...
@@ -664,6 +704,7 @@ public class NewService extends AccessibilityService {
...
@@ -664,6 +704,7 @@ public class NewService extends AccessibilityService {
return
;
return
;
}
}
Log
.
d
(
TAG
,
"开始上报结果 "
+
code
+
" "
+
id
);
Log
.
d
(
TAG
,
"开始上报结果 "
+
code
+
" "
+
id
);
showToast
(
getApplicationContext
(),
"开始上报结果 "
+
code
+
" "
+
id
);
HttpClientApi
.
devicesScan
(
PushServiceFactory
.
getCloudPushService
().
getDeviceId
(),
HttpClientApi
.
devicesScan
(
PushServiceFactory
.
getCloudPushService
().
getDeviceId
(),
code
,
code
,
id
,
id
,
...
@@ -745,6 +786,8 @@ public class NewService extends AccessibilityService {
...
@@ -745,6 +786,8 @@ public class NewService extends AccessibilityService {
outputStream
.
close
();
outputStream
.
close
();
}
catch
(
Throwable
t
)
{
}
catch
(
Throwable
t
)
{
t
.
printStackTrace
();
t
.
printStackTrace
();
//报错说明权限没有
logToastAndUpload
(
TAG
,
"没有root权限,点击失败"
);
}
}
}
}
...
@@ -791,7 +834,7 @@ public class NewService extends AccessibilityService {
...
@@ -791,7 +834,7 @@ public class NewService extends AccessibilityService {
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
private
boolean
fill
()
{
private
boolean
fill
()
{
AccessibilityNodeInfo
rootNode
=
getRootInActiveWindow
();
AccessibilityNodeInfo
rootNode
=
getRootInActiveWindow
();
if
(
rootNode
!=
null
)
{
if
(
rootNode
!=
null
&&
taskMsg
!=
null
)
{
return
findEditText
(
rootNode
,
taskMsg
.
getQr_addr
());
return
findEditText
(
rootNode
,
taskMsg
.
getQr_addr
());
}
}
return
false
;
return
false
;
...
@@ -971,12 +1014,37 @@ public class NewService extends AccessibilityService {
...
@@ -971,12 +1014,37 @@ public class NewService extends AccessibilityService {
.
subscribe
(
new
Action1
<
String
>()
{
.
subscribe
(
new
Action1
<
String
>()
{
@Override
@Override
public
void
call
(
String
s
)
{
public
void
call
(
String
s
)
{
Toast
.
makeText
(
context
,
s
,
Toast
.
LENGTH_
LONG
).
show
();
Toast
.
makeText
(
context
,
s
,
Toast
.
LENGTH_
SHORT
).
show
();
}
}
});
});
}
}
public
static
void
logToastAndUpload
(
String
tag
,
String
msg
){
Log
.
d
(
tag
,
msg
);
if
(
myApplication
.
getInstence
()
!=
null
){
showToast
(
myApplication
.
getInstence
(),
msg
);
}
//不管成功还是失败
HttpClientApi
.
uploadDeviceLog
(
PushServiceFactory
.
getCloudPushService
().
getDeviceId
(),
tag
,
msg
,
new
Subscriber
<
String
>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
Log
.
d
(
"uploadDeviceLog"
,
e
.
getMessage
());
}
@Override
public
void
onNext
(
String
o
)
{
Log
.
d
(
"uploadDeviceLog"
,
o
);
}
});
}
public
static
void
awakeWechat
(
Context
context
){
public
static
void
awakeWechat
(
Context
context
){
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
//启动第三方重点是加这个
//启动第三方重点是加这个
...
...
app/src/main/java/com/xf/weixinclick/http/ClientApi.java
View file @
8679180c
...
@@ -21,4 +21,6 @@ public interface ClientApi{
...
@@ -21,4 +21,6 @@ public interface ClientApi{
Observable
<
String
>
devicesScan
(
@Body
Map
<
String
,
String
>
params
);
Observable
<
String
>
devicesScan
(
@Body
Map
<
String
,
String
>
params
);
@POST
(
"devices/enable"
)
@POST
(
"devices/enable"
)
Observable
<
String
>
devicesEnable
(
@Body
Map
<
String
,
String
>
params
);
Observable
<
String
>
devicesEnable
(
@Body
Map
<
String
,
String
>
params
);
@POST
(
"devices/log"
)
Observable
<
String
>
devicesLog
(
@Body
Map
<
String
,
String
>
params
);
}
}
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
View file @
8679180c
...
@@ -184,4 +184,16 @@ public class HttpClientApi {
...
@@ -184,4 +184,16 @@ public class HttpClientApi {
.
observeOn
(
main
)
.
observeOn
(
main
)
.
subscribe
(
subscriber
);
.
subscribe
(
subscriber
);
}
}
public
static
void
uploadDeviceLog
(
String
device_code
,
String
tag
,
String
message
,
Subscriber
<
String
>
subscriber
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
device_code
);
map
.
put
(
"name"
,
tag
);
map
.
put
(
"msg"
,
message
);
getInstance
().
devicesLog
(
map
)
.
subscribeOn
(
io
)
.
observeOn
(
io
)
.
subscribe
(
subscriber
);
}
}
}
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