chore(apk): 用生产 APK 提取的正式图标与启动图替换占位素材
@ -0,0 +1,34 @@
|
||||
package com.gztbyc.pda_wms;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* 开机自启:监听系统开机完成广播,自动拉起应用。
|
||||
* 说明:Android 3.1+ 要求应用至少被用户启动过一次后,BOOT_COMPLETED 才会送达。
|
||||
*/
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String ACTION_QUICKBOOT_POWERON = "android.intent.action.QUICKBOOT_POWERON";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent == null || intent.getAction() == null) {
|
||||
return;
|
||||
}
|
||||
final String action = intent.getAction();
|
||||
if (!Intent.ACTION_BOOT_COMPLETED.equals(action) && !ACTION_QUICKBOOT_POWERON.equals(action)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Intent launch = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
|
||||
if (launch != null) {
|
||||
launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
context.startActivity(launch);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 启动失败不阻断系统广播
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 32 KiB |