如何使Android应用开机时自动启动

2025-04-30 05:56:11
推荐回答(1个)
回答1:

注册一下开机广播,
public class BootReciver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
Intent mBootIntent = new Intent(context, Service.class);
context.startService(mBootIntent);
}
}
然后在广播中启动自己的程序