0
我需要在启动时启动我的应用程序。我发现this answer服务在启动时启动。我也发现this thread他们使用intent-filter
为了接收在启动广播的android.content.Intent.BOOT_COMPLETED_ACTION
。在启动时启动应用程序的最佳方式?
如果我不需要启动服务,获取设备启动事件的最佳方式是什么?
我需要在启动时启动我的应用程序。我发现this answer服务在启动时启动。我也发现this thread他们使用intent-filter
为了接收在启动广播的android.content.Intent.BOOT_COMPLETED_ACTION
。在启动时启动应用程序的最佳方式?
如果我不需要启动服务,获取设备启动事件的最佳方式是什么?
使用android.intent.action.BOOT_COMPLETED
也在onRecieve功能添加许可"android.permission.RECEIVE_BOOT_COMPLETED"
启动luncher actiivity注册接收
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, First.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}