Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
严琪
/
paysplug-in
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
bda46223
authored
Mar 05, 2018
by
严琪
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into work
parents
00e1b484
1c4ab18c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
5 deletions
+21
-5
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
+1
-1
app/src/main/java/com/yuqirong/listenwechatnotification/broadcastReceiver/MyAwakenReceiver.java
+7
-2
app/src/main/java/com/yuqirong/listenwechatnotification/function/JobAwaken.java
+12
-1
app/src/main/res/xml/accessibility_service_config.xml
+1
-1
git
+0
-0
No files found.
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
View file @
bda46223
...
@@ -196,7 +196,7 @@ private void checkNotificationPermission() {
...
@@ -196,7 +196,7 @@ private void checkNotificationPermission() {
//设置闹钟从当前时间开始,每隔5s执行一次PendingIntent对象pi,注意第一个参数与第二个参数的关系
//设置闹钟从当前时间开始,每隔5s执行一次PendingIntent对象pi,注意第一个参数与第二个参数的关系
// 5秒后通过PendingIntent pi对象发送广播
// 5秒后通过PendingIntent pi对象发送广播
am
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
System
.
currentTimeMillis
(),
5000
*
60
*
6
0
,
pi
);
am
.
setRepeating
(
AlarmManager
.
RTC_WAKEUP
,
System
.
currentTimeMillis
(),
100
0
,
pi
);
}
}
/**
/**
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/broadcastReceiver/MyAwakenReceiver.java
View file @
bda46223
...
@@ -23,13 +23,19 @@ import static android.content.ContentValues.TAG;
...
@@ -23,13 +23,19 @@ import static android.content.ContentValues.TAG;
public
class
MyAwakenReceiver
extends
BroadcastReceiver
{
public
class
MyAwakenReceiver
extends
BroadcastReceiver
{
private
String
TAG
=
"MyAwakenReceiver"
;
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(!
isServiceExisted
(
context
,
"com.alipay.pushsdk.push.NotificationService"
))
{
if
(!
isServiceExisted
(
context
,
"com.alipay.pushsdk.push.NotificationService"
))
{
Log
.
d
(
TAG
,
"支付宝开启 "
);
JobAwaken
jobAwaken
=
new
JobAwaken
();
JobAwaken
jobAwaken
=
new
JobAwaken
();
jobAwaken
.
awakenAPliay
(
context
);
jobAwaken
.
awakenAPliay
(
context
);
}
else
if
(!
isServiceExisted
(
context
,
"com.tencent.mm.booter.NotifyReceiver$NotifyService"
)){
Log
.
d
(
TAG
,
"微信开启 "
);
JobAwaken
jobAwaken
=
new
JobAwaken
();
jobAwaken
.
awakenWeChat
(
context
);
}
else
{
}
else
{
Log
.
d
(
TAG
,
"不需要开启 "
);
Log
.
d
(
TAG
,
"不需要开启 "
);
}
}
...
@@ -46,8 +52,7 @@ public class MyAwakenReceiver extends BroadcastReceiver {
...
@@ -46,8 +52,7 @@ public class MyAwakenReceiver extends BroadcastReceiver {
for
(
int
i
=
0
;
i
<
serviceList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
serviceList
.
size
();
i
++)
{
ActivityManager
.
RunningServiceInfo
serviceInfo
=
serviceList
.
get
(
i
);
ActivityManager
.
RunningServiceInfo
serviceInfo
=
serviceList
.
get
(
i
);
ComponentName
serviceName
=
serviceInfo
.
service
;
ComponentName
serviceName
=
serviceInfo
.
service
;
if
(
serviceName
.
getClassName
().
toString
().
contains
(
className
))
{
if
(
serviceName
.
getClassName
().
toString
().
contains
(
className
)){
Log
.
d
(
TAG
,
"onReceive:进程存在 "
);
return
true
;
return
true
;
}
}
}
}
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/function/JobAwaken.java
View file @
bda46223
...
@@ -18,7 +18,18 @@ public class JobAwaken {
...
@@ -18,7 +18,18 @@ public class JobAwaken {
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
);
//重点是加这个
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
);
//重点是加这个
ComponentName
cn
=
new
ComponentName
(
"com.eg.android.AlipayGphone"
,
"com.alipay.mobile.quinox.LauncherActivity"
);
ComponentName
cn
=
new
ComponentName
(
"com.eg.android.AlipayGphone"
,
"com.alipay.mobile.quinox.LauncherActivity"
);
if
(
cn
==
null
){
if
(
cn
==
null
){
Toast
.
makeText
(
context
,
"未安装"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
context
,
"未安装支付宝"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
intent
.
setComponent
(
cn
);
context
.
startActivity
(
intent
);
}
}
public
void
awakenWeChat
(
Context
context
){
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
);
//重点是加这个
ComponentName
cn
=
new
ComponentName
(
"com.tencent.mm"
,
"com.tencent.mm.ui.LauncherUI"
);
if
(
cn
==
null
){
Toast
.
makeText
(
context
,
"未安装微信"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
}
else
{
intent
.
setComponent
(
cn
);
intent
.
setComponent
(
cn
);
context
.
startActivity
(
intent
);
context
.
startActivity
(
intent
);
...
...
app/src/main/res/xml/accessibility_service_config.xml
View file @
bda46223
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service
xmlns:android=
"http://schemas.android.com/apk/res/android"
<accessibility-service
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:description=
"@string/accessibility_service_description"
android:description=
"@string/accessibility_service_description"
android:packageNames=
"com.eg.android.AlipayGphone"
android:packageNames=
"com.eg.android.AlipayGphone
,com.tencent.mm
"
android:accessibilityEventTypes=
"typeAllMask"
android:accessibilityEventTypes=
"typeAllMask"
android:accessibilityFlags=
"flagDefault"
android:accessibilityFlags=
"flagDefault"
android:accessibilityFeedbackType=
"feedbackSpoken"
android:accessibilityFeedbackType=
"feedbackSpoken"
...
...
git
0 → 100644
View file @
bda46223
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