在Androidmainfest.xml文件中注册,action 为 android.intent.action.BOOT_COMPLETED
<receiver android:name="com.noahedu.teachingvideo.msgpropell.BootcompleteReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> 然后在java文件中 监听 package com.noahedu.teachingvideo.msgpropell; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class BootcompleteReceiver extends BroadcastReceiver { @Override public void onReceive(Context context,Intent intent) { if(Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { Log.v(PropellingService.TAG, "BootcompleteReceiver start!!!!!!!!!!!!!"); PropellingUtils.startPropellingService(context, PropellingService.ACTION_SCHEDULE_COURSE); //启动提醒服务 } } }