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

  • SEARCH
  • Home
  • 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 8876839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:18:53+00:00 2026-06-14T19:18:53+00:00

I have a NotificationManager that successfully creates a Notification : private void showNotification() {

  • 0

I have a NotificationManager that successfully creates a Notification:

 private void showNotification() {
    Notification notification = new Notification(R.drawable.snog_icon, getString(R.string.sn_g_entering_beacon_mode_),
            System.currentTimeMillis());

    // The PendingIntent to launch our activity if the user selects this notification
    Intent i = new Intent(this, SnogActivity.class);
    i.putExtra("fromNotification", "yes");

    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, 0);

    notification.setLatestEventInfo(this, getString(R.string.sn_g_avalanche_buddy),
                   getString(R.string.beacon_mode_activated_), contentIntent);
    notification.flags |= Notification.FLAG_ONGOING_EVENT; // Notification.DEFAULT_ALL 

    // Send the notification.
    // We use a string id because it is a unique number.  We use it later to cancel.
    mNM.notify(R.string.service_started, notification);
}

That part works fine and it shows my notification, and the correct activity is started when I tap the notification. Later in the app I try to notify a simple notification:

Notification not = new Notification(R.drawable.snog_icon, "checker", System.currentTimeMillis());
not.flags |= Notification.DEFAULT_ALL;

mNM.notify(R.string.checker, not);

And that crashes the app in the notify() call with a IllegalArgumentException. I am supposed to use NotificationCompat.Builder according to quite some internet results, but that is not even available.

  • 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-14T19:18:55+00:00Added an answer on June 14, 2026 at 7:18 pm

    You could fix this exception, but I would rather do it right from the beginning by using the NotifcationCompat. It is available on the compatibility package, you have to add by Right click on your eclipse project > Android Tools > Add Support Library

    after this, you will have the NotificationCompat available in your project…then visit the site: http://developer.android.com/guide/topics/ui/notifiers/notifications.html

    there are some great and simple examples there.

    Good luck!

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

Sidebar

Related Questions

I have the following code for dispatching a notification... private void publishNotification(Intent intent, String
I have created an application that creates notifications, using the following code: // notification
I have a service that create a notification when it is started. And then
I have an Activity that starts a Service. In my Activity: startService(new Intent(this, MyService.class));
I have a notification set up in an activity. It creates the notification as
I have a timer that start a notification when it ends. But I would
I have a service that when it finishs running tasks it plays a notification
Hi I’m new to android and I’m developing a reminder that have three categories
I have an Android app that uses the NotificationManager to inform the user of
I have an app that starts a service that continuously updates the notification bar.

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.