我在library
項目中實施了Broadcast Receiver
以檢查Boot Completed
事件,但它不起作用。庫項目中的廣播接收器不工作
廣播接收機類:
public class Reciever extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent)
{
if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
{
Toast.makeText(context, "Device Boot Completed", Toast.LENGTH_LONG).show();
}
}
}
的AndroidManifest.xml:
<receiver
android:name=".Reciever"
android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
我實現了相同的接收器在其他應用程序(不庫項目),它是工作的罰款。
你在圖書館和應用程序的清單中添加接收器? – Ran