2023.9.19
目前已经成功搭建好环境正在开始挂机验证
---------------------
前置要求:
“悬浮窗”在部分机型需要。因此建议也申请。
刚需:“锁屏启动”、“后台弹出应用/在其他应用之上” 三大权限。
以下为各大厂商跳转到权限设置界面代码。
/**
* @description 跳转各个手机系统权限设置界面
*/
public class LockStartTool {
private static final String TAG = "JumpPermissionManagement";
/**
* Build.MANUFACTURER
*/
private static final String MANUFACTURER_HUAWEI = "HUAWEI";//华为
private static final String MANUFACTURER_MEIZU = "Meizu";//魅族
private static final String MANUFACTURER_XIAOMI = "Xiaomi";//小米
private static final String MANUFACTURER_SONY = "Sony";//索尼
private static final String MANUFACTURER_OPPO = "OPPO";//oppo
private static final String MANUFACTURER_LG = "LG";
private static final String MANUFACTURER_VIVO = "vivo";//vivo
private static final String MANUFACTURER_SAMSUNG = "samsung";//三星
private static final String MANUFACTURER_ZTE = "ZTE";//中兴
private static final String MANUFACTURER_YULONG = "YuLong";//酷派
private static final String MANUFACTURER_LENOVO = "LENOVO";//联想
/**
* 此函数可以自己定义
*
* @param activity
*/
public static void GoToSetting(Activity activity) {
switch (Build.MANUFACTURER) {
case MANUFACTURER_HUAWEI:
Huawei(activity);
break;
case MANUFACTURER_MEIZU:
Meizu(activity);
break;
case MANUFACTURER_XIAOMI:
Xiaomi(activity);
break;
case MANUFACTURER_SONY:
Sony(activity);
break;
case MANUFACTURER_OPPO:
OPPO(activity);
break;
case MANUFACTURER_VIVO:
VIVO(activity);
break;
case MANUFACTURER_LG:
LG(activity);
break;
default:
ApplicationInfo(activity);
Log.e("goToSetting", "目前暂不支持此系统");
break;
}
}
public static void Huawei(Activity activity) {
try {
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("packageName", activity.getApplicationInfo().packageName);
ComponentName comp = new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity");
intent.setComponent(comp);
activity.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
goIntentSetting(activity);
}
}
public static void Meizu(Activity activity) {
try {
Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra