mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
Beep does not crash your app if there is no notification sound
This commit is contained in:
parent
36bd034ee5
commit
d6e79f158f
@ -57,9 +57,11 @@ public class Device{
|
|||||||
{
|
{
|
||||||
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||||
Ringtone notification = RingtoneManager.getRingtone(mCtx, ringtone);
|
Ringtone notification = RingtoneManager.getRingtone(mCtx, ringtone);
|
||||||
for (long i = 0; i < pattern; ++i)
|
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();
|
{
|
||||||
|
notification.play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user