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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:53:04+00:00 2026-06-10T06:53:04+00:00

The full error also contains: android.app.RemoteServiceException: Bad notification for startForeground: I’ve read other similar

  • 0

The full error also contains:

    android.app.RemoteServiceException: Bad notification for startForeground:

I’ve read other similar posts here, tried their suggestions and read their links, but a small number of users are still reporting this error.

Overview

An activity is started by an external application. This activity starts a custom speech recognition service. It does not use startForeground:

    this.startService(intent);

The activity then calls finish();

The service starts the custom speech recognition class and passes context to it in a constructor. On ‘beginning of speech detected’ I display the following notification:

    String notTitle = "Hello";
    String notificationText = "hello there";

    notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    myNotification = new Notification(
                android.R.drawable.ic_btn_speak_now, notTitle,
                System.currentTimeMillis());
    myNotification.flags |= Notification.FLAG_AUTO_CANCEL;

    Intent intent = new Intent();
    intent.setAction("com.android.settings.TTS_SETTINGS");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
        myNotification.contentIntent = pendingIntent;

    myNotification.setLatestEventInfo(mContext, notTitle,
                notificationText, pendingIntent);

    notificationManager.notify(MY_NOTIFICATION_ID, myNotification);

The notification has no requirement to do anything ‘onClick’ as it’s cancelled as soon as the user stops talking. I was originally passing a ‘null intent’, however, after reading many posts, I added in the random intent/pendingIntent of displaying TTS Settings, just to rule this out as the problem.

99% of my users don’t have an issue with either the above code or passing a null intent. I need to solve this for the 1% though, as it’s a very important part of my application.

Any suggestions would be very much appreciated.

  • 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-10T06:53:05+00:00Added an answer on June 10, 2026 at 6:53 am

    In my case the Logcat debug was eloquent: ” android.app.RemoteServiceException: Bad notification for startForeground:”
    Second line read: PendingIntent null!

    In Android 4.x having a null PendingIntent is not a problem for starting foreground services, however in earlier Android versions it is.

    So first of all check the debug log carefully (read all the lines and why not, post them here).
    If it is the same problem in your code I would check that the pendingIntent is not null. This could perhaps happen if mContext is null!

    Have a look on the documentation for the setLatestEventInfo.

    Here is how your code should look (if you are pushing these notifications from a service):

            // The PendingIntent to launch our activity if the user selects this notification
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, LocalServiceActivities.Controller.class), 0);
    
        // Set the info for the views that show in the notification panel.
        notification.setLatestEventInfo(this, getText(R.string.local_service_label),
                       text, contentIntent);
    

    Code was quoted from Android official documentation.

    Also see this for a similar issue on StackOverflow.

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

Sidebar

Related Questions

The full error is: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]:
The full error is: ImportError: Could not import settings 'app.settings' (Is it on sys.path?):
The full error I'm getting is this: error: ambiguous overload for ‘operator[]’ in ‘a[boost::_bi::storage4<A1,
This is the full error report that is generated when tried to compile my
See the full error here: http://notesapp.heroku.com/ I'm using DataMapper and dm-validations 0.10.2. No matter
Seems like cuke doesn't show the full error message (at least when problem occurs
okay, the full error is 06-19 01:07:57.421: E/AndroidRuntime(4478): java.lang.RuntimeException: Error receiving broadcast Intent {
I am getting the common ASP.NET YSOD error. Here is the full error page
I'm attempting to print a bitmap from an Espon receipt printer. The full error
you can view full source code here dpaste.com/hold/167199 Error: delete() takes exactly 2 arguments

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.