Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Play Device's default Notification sound

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 161
    Comment on it

    You can play android device's default notification sound using RingtoneManager:

    • Get the path url of the notification sound from the getDefaultUri() method.
    • Pass this url to getRingtone() method which will return the Ringtone Object
    • Play that ringtone through play().
    1. try {
    2. Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    3. Ringtone r = RingtoneManager.getRingtone(getApplicationContext(),notification);
    4. r.play();
    5. }
    6. catch (Exception e) {
    7. e.printStackTrace();
    8. }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: