mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Beep does not crash your app if there is no notification sound
This commit is contained in:
parent
8e7ce8780e
commit
3cba58ce57
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user