How do you allow the device to vibrate or make a sound when a notification is launched.
Ive heard of the FLAGS. But how would i use them for Sound and Vibration?
The ringtone and notification sound volume can't be adjust separately as the Android operating system uses a single volume control for both. If you've increased the ringtone volume and the notification sound seems too loud for you, consider muting the notification sound. To mute the notification sound: Go to Settings.
If Vibration is turned off in Accessibility settings, your iPhone won't vibrate even if the vibration motor is fully functional. Go to Settings -> Accessibility -> Touch and make sure the switch next to Vibration is turned on.
Edit In Android v4 support library, there is NotificationCompat.Builder
and the method setSound
which will work if using that class instead. However, the info below will still work.
Notification notif ... //create your notification notif.defaults |= Notification.DEFAULT_SOUND; notif.defaults |= Notification.DEFAULT_VIBRATE;
That adds sound and vibrate.
Always remember to check the docs. They have a LOT of answers, such as this one:
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
That has the info I posted above as well as info on how to use a custom sound or vibrate and also the entire process of creating a notification.
EDIT: Don't forget to include the Vibrate permission in your manifest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With