You are using FLAG_ACTIVITY_NEW_TASK with an intent that is being used for a
-broadcast-.  Don't do that.

On Sat, Nov 7, 2009 at 2:15 AM, Teo [GD API Guru] <[email protected]>wrote:

> Hi everyone,
>
> i have some code that is creating and removing alarms, and which works
> great in Android 1.5 and 1.6 but breaks on the Android 2.0 AVD.
>
> The code that's giving this exception is:
>
>      Intent intent = new Intent(context, AlarmReceiver.class).setFlags
> (
>          Intent.FLAG_ACTIVITY_NEW_TASK).putExtra(SleepDB.KEY_ID, 0);
>      PendingIntent pi = PendingIntent.getBroadcast(context, 0 /* id
> */,
>          intent, 0);
>
> The second line has the problems, the one which actually gets the
> broadcast. I pasted below the relevant part of the log:
>
> 11-07 12:08:56.042: ERROR/AndroidRuntime(242): Uncaught handler:
> thread main exiting due to uncaught exception
> 11-07 12:08:56.062: ERROR/AndroidRuntime(242):
> java.lang.IllegalArgumentException: Can't use
> FLAG_RECEIVER_BOOT_UPGRADE here
> 11-07 12:08:56.062: ERROR/AndroidRuntime(242):     at
> android.os.Parcel.readException(Parcel.java:1222)
> 11-07 12:08:56.062: ERROR/AndroidRuntime(242):     at
> android.os.Parcel.readException(Parcel.java:1206)
> 11-07 12:08:56.062: ERROR/AndroidRuntime(242):     at
> android.app.ActivityManagerProxy.getIntentSender
> (ActivityManagerNative.java:2053)
> 11-07 12:08:56.062: ERROR/AndroidRuntime(242):     at
> android.app.PendingIntent.getBroadcast(PendingIntent.java:230)
> 11-07 12:08:56.062: ERROR/AndroidRuntime(242):     at
> com.teo.lifestyle.sleep.Utils.deleteAlarms(Utils.java:57)
>
> I googled FLAG_RECEIVER_BOOT_UPGRADE but there were no results. Since
> this works ok on previous versions of Android i assume it's a bug..
> Should i file it or have i actually missed something?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to