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,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