Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.IllegalArgumentException: contentIntent required
    primarykey
    data
    text
    <p>The full error also contains:</p> <pre><code> android.app.RemoteServiceException: Bad notification for startForeground: </code></pre> <p>I've read other similar posts <a href="https://stackoverflow.com/questions/3112008/android-java-lang-illegalargumentexception-contentintent-required-error-cause">here</a>, tried their suggestions and read their links, but a small number of users are still reporting this error.</p> <p><strong>Overview</strong></p> <p>An activity is started by an external application. This activity starts a custom speech recognition service. It <strong>does not</strong> use startForeground:</p> <pre><code> this.startService(intent); </code></pre> <p>The activity then calls finish();</p> <p>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:</p> <pre><code> 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); </code></pre> <p>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.</p> <p>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.</p> <p>Any suggestions would be very much appreciated. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload