0

I'm having a bug report, for some android device with version 2.3.X :

android.app.RemoteServiceException: Bad notification for startForeground: java.lang.IllegalArgumentException

Here's my method...

final static int myID = 6785674; public void putServiceToForeground() { if (notif == null) { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(MyApp.getAppContext()) .setContentTitle(""); notif = mBuilder.build(); notif.icon = R.drawable.pixel; } startForeground(myID, notif); } 

1 Answer 1

1

Use the Builder to set the icon and also double check the documentation.

Required notification contents

A Notification object must contain the following:

  • A small icon, set by setSmallIcon()
  • A title, set by setContentTitle()
  • Detail text, set by setContentText()
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.