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 9191881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:47:37+00:00 2026-06-17T20:47:37+00:00

I’m an android newbie, so please be patient! Finally, I got my XML result

  • 0

I’m an android newbie, so please be patient!

Finally, I got my XML result from a simple WCF REST API via GCM wishing to build a simple notification with its payload.

@Override
protected void onMessage(Context arg0, Intent arg1) {

    String message = arg1.getStringExtra("payload");
    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    Notification note = new Notification();
    note.tickerText=message;
    note.when=System.currentTimeMillis();
    note.defaults |= Notification.DEFAULT_ALL;

    notificationManager.notify(new Random().nextInt(), note);

}

I’m hearing my default notification sound but my bar isn’t showing anything, What I’m missing?


EDIT I

Note:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="17" /> 

I tried Jeeter suggestion about building the notification up with the builder, however a MINIMUM API 16 is required which isn’t good + my Galaxy note test device is 4.0.4 which is API 15!

@Override
protected void onMessage(Context arg0, Intent arg1) {

    String Message = arg1.getStringExtra("payload");
    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    notificationManager.notify(
            new Random().nextInt(),
            new Notification.Builder(this)
                    .setContentTitle(Message)
                    .setContentText(Message).build());

}

public Notification build ()
Added in API level 16
Combine all of the options that have been set and return a new
Notification object.


EDIT II

I tried A–C suggestion about using NotificationCompat builder.

@Override
protected void onMessage(Context arg0, Intent arg1) {

    String Message = arg1.getStringExtra("payload");
    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

            notificationManager.notify(
            new Random().nextInt(),
            new NotificationCompat.Builder(this).setContentTitle("Message")
                    .setWhen(System.currentTimeMillis())
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentText(Message).build());

}

No errors but nothing changed, I still hear sound with no appearance, however the message reached the onMessage method.

  • 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-17T20:47:38+00:00Added an answer on June 17, 2026 at 8:47 pm

    Android requires a small icon to be set for it to actually show your status bar notification.

    From the documentation, these are the requirements:

    A Notification object must contain the following:

    • A small icon, set by setSmallIcon()

    • A title, set by setContentTitle()

    • Detail text, set by setContentText()

    Additionally, older platforms (Gingerbread and lower) require a PendingIntent (referred to as the content Intent in the documentation) passed for the Notification to show. This is a limitation of the platform(s).

    Depending on how you show the Notification, by not setting a content Intent, the app will crash and the stack trace will be very clear about the reason why.

    Using NotificationCompat.Builder, it is easy to set a content Intent via NotificationCompat.Builder#setContentIntent()

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

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.