播放Android的默认音效

问题描述:

有没有一种方法来播放内置的音效编程?我想在我的应用程序扫描NFC标签时播放NFC音效(成功音效和失败音效)。播放Android的默认音效

我只是粘贴从接受的答案是在代码 - * question to play Android Notification sound

try { 
    Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 
    Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification); 
    r.play(); 
} catch (Exception e) { 
    e.printStackTrace(); 
} 
+0

我将如何发挥NFC的声音效果? –