Reputation: 185
I have made an android taxi hailing app like Uber. When a request is going to the driver, it is showing as a notification like any other notification of whatsapp and message with the default popup notification sound. I need the notification sound to ring for 15 to 20 seconds instead of the pop up sound . How do I do this ?
Upvotes: 2
Views: 565
Reputation: 179
try to set the ring tone file which have a length of 15 to 20 sec
//App.appInstance --> Application class instance
Uri uri = Uri.parse("android.resource://" + App.appInstance.getPackageName() + "/" +
R.raw.notification_sound);
NotificationCompat.Builder builder = new NotificationCompat.Builder(App.appInstance, "")
.setSound(uri)
place the sound file in the raw folder
Upvotes: 2
Reputation: 994
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Notification mNotification = new Notification.Builder(this)
................setSound(soundUri).........
.build();
Upvotes: 1