Android - java.lang.IllegalArgumentException: contentIntent required error caused by notification?

后端 未结 4 2249
北荒
北荒 2021-02-19 00:52

I have a service running that updates a notification in the notification bar when it recieves a message saying it has to be changed.

However I get the following error so

4条回答
  •  生来不讨喜
    2021-02-19 01:14

    you need to set the contentIntent for your notification.

    in your case:

    notification.contentIntent = notificationIntent;
    

    otherwise you will get the message, that the contentIntent of the notification is null, because it's not set.

    the docu is here: http://developer.android.com/reference/android/app/Notification.html#contentIntent

    i have a little example here: http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android

提交回复
热议问题