Commit bda46223 by 严琪

Merge branch 'master' into work

parents 00e1b484 1c4ab18c
...@@ -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*60,pi); am.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),1000,pi);
} }
/** /**
......
...@@ -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;
} }
} }
......
...@@ -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);
......
<?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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment