Commit 1c4ab18c by 严琪

上传微信和支付宝可用版本

parent fe95833b
......@@ -24,7 +24,7 @@
<application
android:exported="false"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
......
......@@ -176,7 +176,7 @@ private void checkNotificationPermission() {
//设置闹钟从当前时间开始,每隔5s执行一次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);
}
@Override
......
......@@ -23,13 +23,19 @@ import static android.content.ContentValues.TAG;
public class MyAwakenReceiver extends BroadcastReceiver {
private String TAG = "MyAwakenReceiver";
@Override
public void onReceive(Context context, Intent intent) {
if (!isServiceExisted(context,"com.alipay.pushsdk.push.NotificationService")) {
Log.d(TAG, "支付宝开启 ");
JobAwaken jobAwaken = new JobAwaken();
jobAwaken.awakenAPliay(context);
}else if(!isServiceExisted(context,"com.tencent.mm.booter.NotifyReceiver$NotifyService")){
Log.d(TAG, "微信开启 ");
JobAwaken jobAwaken = new JobAwaken();
jobAwaken.awakenWeChat(context);
}else{
Log.d(TAG, "不需要开启 ");
}
......@@ -46,8 +52,7 @@ public class MyAwakenReceiver extends BroadcastReceiver {
for(int i = 0; i < serviceList.size(); i++) {
ActivityManager.RunningServiceInfo serviceInfo = serviceList.get(i);
ComponentName serviceName = serviceInfo.service;
if(serviceName.getClassName().toString().contains(className)) {
Log.d(TAG, "onReceive:进程存在 ");
if(serviceName.getClassName().toString().contains(className)){
return true;
}
}
......
......@@ -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);//重点是加这个
ComponentName cn = new ComponentName("com.eg.android.AlipayGphone", "com.alipay.mobile.quinox.LauncherActivity");
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 {
intent.setComponent(cn);
context.startActivity(intent);
......
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
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:accessibilityFlags="flagDefault"
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