Измените pu sh звук уведомления на android - PullRequest
0 голосов
/ 26 марта 2020

Как использовать собственный звук для уведомлений pu sh?

Это мой код с уведомлением по умолчанию:

Uri uri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "default")
                .setSmallIcon(R.drawable.logo)
                .setContentTitle("Notification")
                .setContentText(bodyNotif)
                .setSound(uri)
                .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                .setContentIntent(pendingIntent)
                .setAutoCancel(true);

        Random random = new Random();
        int count = random.nextInt(9999 - 1000) + 1000;
        Log.e(TAG, "push sendNotification: COUNT "+count );

        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
        notificationManager.notify(count, mBuilder.build());
        createNotificationChannel();
...