Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android sometimes I get android.app.RemoteServiceException: Bad notification posted from package. Why?

I have a serius problem with my notification.

Sometimes when my app post the same custom notification I get this error:

android.app.RemoteServiceException: Bad notification posted from package  com.packagename: Couldn't expand RemoteViews for: ClassName(package=com.packagename id=0     tag=null notification=Notification(vibrate=null,sound=null,defaults=0x0,flags=0x22))
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1093)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3906)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:598)
at dalvik.system.NativeStart.main(Native Method)

What I have to do?

The notification contains only LinearLayout, TextViews and ImageViews and it works perfect most of the time.

There is a way to surround this error with try/catch so in this way android not stop my app?

Many thanks...

like image 684
Meroelyth Avatar asked Jul 16 '12 19:07

Meroelyth


1 Answers

1) http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/android/app/ActivityThread.java#ActivityThread

From here we can see that this error can arise only in the one case:

case SCHEDULE_CRASH:
throw new RemoteServiceException((String)msg.obj);

2)http://openstorage.gunadarma.ac.id/android/sdk/sdk_310712/sources/android-15/android/app/ApplicationThreadNative.java

case SCHEDULE_CRASH_TRANSACTION:
        {
            data.enforceInterface(IApplicationThread.descriptor);
            String msg = data.readString();
            scheduleCrash(msg);
            return true;
        }

So this error arises from the ApplicationThreadNative

You can try to track ahead and maybe you will find the cause of this error.

like image 132
pvllnspk Avatar answered Nov 15 '22 23:11

pvllnspk