AndroidManifest.xml 有以下代码:
<receiver
android:name=".receivers.RebootReceiver">
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
BroadcastReceiver 的代码:
public class RebootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1) {
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
Toast.makeText(context, "1", Toast.LENGTH_LONG).show();
DataSourceWrapper.getInstance().initializeAllNotifications();
}
}
但是重新启动后我没有收到任何消息。我犯了什么错误?安卓 4.0,HTC 感觉。