panlili2024
2024-11-08 81d297dd33911dbfdc93dbc3fa9747e511b7ce8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.hdl.sdk.ttl_sdk.activity;
 
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
 
import com.hdl.sdk.ttl_sdk.utlis.HDLLog;
import com.hdl.sdk.ttl_sdk.utlis.HDLWarningType;
 
public class BootComplete extends BroadcastReceiver {
    static final String action_boot = "android.intent.action.BOOT_COMPLETED";
 
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(action_boot)) {
            HDLLog.Log("boot start");
            Intent StartIntent = new Intent(context, MainActivity.class); //接收到广播后,跳转到MainActivity
            StartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(StartIntent);
        } else if (intent.getAction().equals("com.hdl.action.WARNING")) {
            int warningType = intent.getIntExtra("HdlWarning",0);
            HDLLog.Log(HDLWarningType.getWarningType(warningType));
        }
 
    }
}