你好,我是新的android开发者。我创建一个示例项目,它在启动完成后运行良好。
然后,我再次创建我的主要项目来使用这个,但引导完成,而不是执行.我尽力找出问题..。我通过清单文件注册这个接收器,而不是务实地.
public void onReceive(Context context, Intent intent) {
// TODO: This method is called when the BroadcastReceiver is receiving
// an Intent broadcast.
Toast.makeText(context, "boot completed", Toast.LENGTH_LONG).show();
//throw new UnsupportedOperationException("Not yet implemented");
}是Manifest XML吗?
<receiver
android:name="com.azmizryk.mobilethefttracker.BootCompleted"
android:enabled="true"
android:exported="true" >
</receiver>发布于 2014-06-30 17:52:52
在manifest.xml文件中添加以下意图操作。
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.BOOT_COMPLETED" />即在您的清单文件中,更改
<receiver
android:name="com.azmizryk.mobilethefttracker.BootCompleted"
android:enabled="true"
android:exported="true" >
</receiver>至
<receiver
android:name="com.azmizryk.mobilethefttracker.BootCompleted"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>https://stackoverflow.com/questions/24496005
复制相似问题