1
我得到這個例外,在我的代碼:意圖的標誌和PendingIntent.getBroadcast
...IllegalArgumentException...Cant use FLAG_RECEIVER_BOOT_UPGRADE here...
展望Android源代碼好像你不能設置標誌,以將通過被解僱的意圖:
PendingIntent.getBroadcast(...);
這裏的Android源代碼:
...
if (type == INTENT_SENDER_BROADCAST) {
if ((intent.getFlags()&Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0) {
throw new IllegalArgumentException("Can't use FLAG_RECEIVER_BOOT_UPGRADE here");
}
}
...
這裏我的代碼:
Intent myIntent = new Intent(context, MyReceiver.class);
//myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if i remove the comment it doesn't work
PendingIntent pending = PendingIntent.
getBroadcast(context, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
原因尚不清楚,有人可以爲我澄清一下嗎?
嘿大衛,這是我的壞。當時我遇到這個問題時沒有給予足夠的關注,謝謝你的迴應。 – gwa 2012-06-25 08:44:46