Android Notification SetSound Is Not Working
Answer : below code will help you: String CHANNEL_ID="1234"; Uri soundUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+ getApplicationContext().getPackageName() + "/" + R.raw.mysound); NotificationManager mNotificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); //For API 26+ you need to put some additional code like below: NotificationChannel mChannel; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mChannel = new NotificationChannel(CHANNEL_ID, Utils.CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH); mChannel.setLightColor(Color.GRAY); mChannel.enableLights(true); mChannel.setDescription(Utils.CHANNEL_SIREN_DESCRIPTION); AudioAttributes audioAttributes = new AudioAttributes.Builder() .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATIO...