Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8072319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:59:01+00:00 2026-06-05T13:59:01+00:00

I get this exception in my code: …IllegalArgumentException…Cant use FLAG_RECEIVER_BOOT_UPGRADE here… Looking into the

  • 0

I get this exception in my code:

...IllegalArgumentException...Cant use FLAG_RECEIVER_BOOT_UPGRADE here...

Looking into the android source code seems like you can’t set flags to an Intent that will be fired through:

PendingIntent.getBroadcast(...);

Here the Android source code:

...
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");
    }
}
...

Here my code:

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);

The reason is not clear to me, anyone could clarify it for me please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:59:03+00:00Added an answer on June 5, 2026 at 1:59 pm

    When you get a PendingIntent using getBroadcast(), this Intent will be broadcast to BroadcastReceivers. It will NOT be used to start an Activity. So you cannot set any of the Activity-related flags. They wouldn’t make any sense in that context anyway.

    Why would you want to set FLAG_ACTIVITY_NEW_TASK in an Intent that will be broadcast? That makes no sense.

    Android uses Intents for 3 completely different purposes:

    1. Starting/Communicating with Activity
    2. Starting/Communicating with Service
    3. Broadcast to BroadcastReceiver

    The PendingIntent class offers 3 different methods to get a PendingIntent for each of these different purposes:

    1. getActivity()
    2. getService()
    3. getBroadcast()

    You need to make sure that you use the right method for the right purpose.

    And yes, you can can set Activity-related Intent flags in a PendingIntent, as long as you call getActivity() to get the PendingIntent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this exception that I get in my crash reports from Android: java.lang.NoSuchMethodError:
I get this exception on that code. How to fix it? Excepton: The calling
Problems with the TabActivity... I get this Exception java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816) at android.app.ActivityThread.startActivityNow(ActivityThread.java:1651) at
I get this exception on my Windows 7 64bit in application running in VS
why do i get this exception? Map myHash = null myHash = (HashMap)Collections.synchronizedMap(new HashMap());
why do I get this exception?please suggest any solutions.i have properly copied mail.jar and
I know i will get this exception when i try to modify or remove
I'm a newbie to hibernate . I get this exception Connection cannot be null
When I try to EDIT a tennis court... I get this exception :System.Data.UpdateException; Unable
How can I get around this exception? Dim imagepathlit As Literal = DownloadsRepeater.FindControl(imagepathlit) imagepathlit.Text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.