获得'E / JavaBinder:!!!绑定交易失败!!! (包裹大小= 9448080)”,尝试建立通知时 [英] Getting 'E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 9448080)' while trying to build a notification

查看:107
本文介绍了获得'E / JavaBinder:!!!绑定交易失败!!! (包裹大小= 9448080)”,尝试建立通知时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试建立一个通知并在一段时间后接收它。

I'm trying to build a notification and receive it after an interval of time.

这是怎么做:

futureInMillis = SystemClock.elapsedRealtime() + 176000;

Intent notificationIntent = new Intent(getBaseContext(), NotificationG.class);
notificationIntent.putExtra(NotificationG.NOTIFICATION, getNotification());
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), m, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, futureInMillis, pendingIntent);

这里的 NotificationG.class

public class NotificationG extends BroadcastReceiver {

    public static String NOTIFICATION = "notification_gatsp";
    public static NotificationManager mNotifyMgr;

    @Override
    public void onReceive(Context context, Intent intent) {

        mNotifyMgr =
                (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);

        Notification notification = intent.getParcelableExtra(NOTIFICATION);
        notification.defaults |= Notification.DEFAULT_SOUND;
        notification.defaults |= Notification.DEFAULT_VIBRATE;
        mNotifyMgr.notify(5, notification);

    }
}

这里是 getNotification()方法:

public Notification getNotification() {

icon = BitmapFactory.decodeResource(getBaseContext().getResources(),
            R.drawable.app_icon_1);

        mBuilder =
                new NotificationCompat.Builder(getBaseContext())
                        .setSmallIcon(R.mipmap.app_icon_1)
                        .setContentTitle("title")
                        .setLargeIcon(icon)
                        .setStyle(new NotificationCompat.BigTextStyle().bigText(""))
                        .setContentText("");

        Intent resultIntent = new Intent(getBaseContext(), ARequest.class);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);
        resultIntent.putExtra("text", text);

        // Because clicking the notification opens a new ("special") activity, there's
        // no need to create an artificial back stack.
        PendingIntent resultPendingIntent =
                PendingIntent.getActivity(
                        getBaseContext(),
                        0,
                        resultIntent,
                        PendingIntent.FLAG_UPDATE_CURRENT
                );

        mBuilder.setAutoCancel(true);
        mBuilder.setContentIntent(resultPendingIntent);
        return mBuilder.build();
    }

但我没有收到任何通知,而是此错误: E / JavaBinder:!!!绑定交易失败!!! (包裹大小= 9448080)正在打印出来。

but I'm not receiving any notification instead this error: E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 9448080) is getting printed out.

发生了什么,如何解决?

请让我知道。

推荐答案

我发现了问题所在在这里,它带有通知的小图标。它超出了粘合剂限制。

I figured out the problem here and it was with the small icon of notification. It was exceeding the binder limit.

相同的图标也保存在我的 mipmap 文件夹中,并将引用从 R更改.drawable.app_icon_1 R.mipmap.app_icon_1 帮了我忙。

The same icon was saved in my mipmap folder too and changing the reference from R.drawable.app_icon_1 to R.mipmap.app_icon_1 did the job for me.

我更改了这一行:

icon = BitmapFactory.decodeResource(getBaseContext().getResources(),
            R.drawable.app_icon_1);

其中:

icon = BitmapFactory.decodeResource(getBaseContext().getResources(),
            R.mipmap.app_icon_1);

现在没有更多错误了。

这篇关于获得'E / JavaBinder:!!!绑定交易失败!!! (包裹大小= 9448080)”,尝试建立通知时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆