IllegalArgumentExeption BroadcastReceiver

152
25 сентября 2021, 17:10

Я получаю уведомления в панели разработчика что в приложении происходят сбои, а именно IllegalArgumentExeption на 9 Андроиде по большей части на устройствах Samsung, я пытался воспроизвести данную ошибку на реальных и виртуальных, но безуспешно. Буду рад любой помощи. Лог ошибки из панели разработчика

java.lang.RuntimeException: 
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3611)
at android.app.ActivityThread.access$1300 (ActivityThread.java:236)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1795)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7037)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Caused by: java.lang.IllegalArgumentException: 
at android.os.Parcel.createException (Parcel.java:1970)
at android.os.Parcel.readException (Parcel.java:1934)
at android.os.Parcel.readException (Parcel.java:1884)
at android.app.INotificationManager$Stub$Proxy.createNotificationChannels (INotificationManager.java:1888)
at android.app.NotificationManager.createNotificationChannels (NotificationManager.java:577)
at android.app.NotificationManager.createNotificationChannel (NotificationManager.java:565)
at  Alarm.AlarmBroadcastReceiver.onReceive (AlarmBroadcastReceiver.java:79)
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3602)
Caused by: android.os.RemoteException: 
at com.android.internal.util.Preconditions.checkArgument (Preconditions.java:33)
at com.android.server.notification.RankingHelper.createNotificationChannel (RankingHelper.java:642)
at com.android.server.notification.NotificationManagerService$12.createNotificationChannelsImpl (NotificationManagerService.java:2585)
at com.android.server.notification.NotificationManagerService$12.createNotificationChannels (NotificationManagerService.java:2600)
at android.app.INotificationManager$Stub.onTransact (INotificationManager.java:292)

Вот код AlarmBroadcastReceiver.java

public class AlarmBroadcastReceiver extends BroadcastReceiver {
    static final String LOG_TAG = "myLog";
    PendingIntent operation;
    private static final int NOTIFICATION_ID = 100;
    @Override
    public void onReceive(Context context, Intent intent) {
        String chenelID = "chanel 1";
        Intent intent1 = new Intent(context, ReminderAlarmService.class);
        context.startService(intent1);
        intent1.getStringExtra("Uri");
        String name = context.getResources().getString(R.string.app_name);
        // Отображение уведомления для просмотра деталей задачи
        Uri uri = intent.getParcelableExtra("Uri");
        Intent action = new Intent(context, DetailsActivity.class);
        action.setData(uri);
        operation = TaskStackBuilder.create(context)
                .addNextIntentWithParentStack(action)
                .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
        // Получить описание задачи
        ContentResolver contentResolver =context.getContentResolver();
        Cursor cursor = contentResolver.query(uri, null, null, null, null);

        String description = "";
        try {
            if (cursor != null && cursor.moveToFirst()) {
                description = ConstantsDB.getColumnString(cursor, ConstantsDB.KEY_NAME);
            }
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
            NotificationCompat.Builder builder = new NotificationCompat.Builder(context, chenelID);
            builder.setAutoCancel(true)
                    .setContentTitle(name)
                    .setContentText(description)
                    .setSmallIcon(R.drawable.ic_notification)
                    .setContentIntent(operation)
                    .setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
                    .setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
                    .setAutoCancel(true);
            NotificationChannel notificationChannel = new NotificationChannel(chenelID, description, NotificationManager.IMPORTANCE_DEFAULT);
            notificationManager.createNotificationChannel(notificationChannel);
            builder.setChannelId( chenelID );
            Notification notification = builder.build();
            notificationManager.notify(NOTIFICATION_ID, notification);

        } else {
            Notification notification = new Notification.Builder(context)
                    .setContentTitle(name)
                    .setContentText(description)
                    .setSmallIcon(R.drawable.ic_notification)
                    .setContentIntent(operation)
                    .setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
                    .setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
                    .setAutoCancel(true)
                    .build();
            notificationManager.notify(NOTIFICATION_ID, notification);
        }
    }

}
READ ALSO
не запускается telegram бот на spring boot

не запускается telegram бот на spring boot

Вот гит - https://githubcom/DeadSidert/commybot

123
Html, css верстка

Html, css верстка

Есть верстка следующего вида:

252
Не работает русский язык в C++ (Ошибка)

Не работает русский язык в C++ (Ошибка)

Мой код должен зашифровать текст по ключевому словуСуть шифра: Вы даете исходный текст и ключевое слово

140