Getting android.app.RemoteServiceException: Bad notification posted from package in custom notification

StackOverflow https://stackoverflow.com/questions/15066001

  •  11-03-2022
  •  | 
  •  

Question

I am trying to create a custom notification using the remote view.

Steps Followed:
1. Created a layout and placed in the res/layout folder
2. Extended the RemoteViews class and implemented some helper methods.
3. Instantiated an object of the Extended class and I am supplying this as Content by using setContent() in the Notification.Builder.
4. Cached the instantiated Extended class.

Now most of the times when I do an operation even before supplying the extended class object to the Notification.Builder its crashing.

E/AndroidRuntime(10194): android.app.RemoteServiceException: Bad notification posted from
package com.motorolasolutions.ptt.mpttclient: Couldn't expand RemoteViews for: 
StatusBarNotification

I have tried following functions

setBoolean(R.id.textview1, "setEnabled", false);

Please let me know how can I call the functions on the remote view.

I tried so many functions which have @android.view.RemotableViewMethod tag in the source code of Android.

Was it helpful?

Solution

Eventhough "setEnabled" function has the @RemotableViewMethod tag in the base class (View.java). This is being overridden in the derived class and doesn't have the @RemotableViewMethod tag. We have to check the tag of the child class if its being overridden.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top