Beep does not crash your app if there is no notification sound

This commit is contained in:
Dave Johnson 2010-07-07 15:54:33 -07:00 committed by Joe Bowser
parent 8e7ce8780e
commit 3cba58ce57

View File

@ -57,11 +57,13 @@ public class Device{
{
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone notification = RingtoneManager.getRingtone(mCtx, ringtone);
if (notification != null) { // This will be the case when the phone is set to silent for example
for (long i = 0; i < pattern; ++i)
{
notification.play();
}
}
}
public void vibrate(long pattern){
// Start the vibration, 0 defaults to half a second.