[英]Display UILocalNOtification Alert in iOS Till VOIP call is valid
我正在使用PJSIP開發iPhone App。 當我進入后台模式時,如果我接到任何電話。 我將UILocalNotification警報顯示為:
UILocalNotification *notification = [[UILocalNotification alloc] init];
NSString *alertBody = [NSString stringWithFormat:@"NEW VOIP CALL"];
notification.alertBody =alertBody;
notification.alertAction = @"Answer";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
但是此警報會在大約4或5秒后消失。 如何使其重復更長的時間?
解決方案1:您需要使用Timer執行UIlaocationNotification。
解決方案2:完成上一個通知后,您將開始執行通知。
在您的情況下,最好的方法是指定要播放的聲音-最長可以持續30秒。 這似乎使通知的顯示時間保持不變:
UILocalNotification *notification =[[UILocalNotification alloc] init];
NSString *alertBody = [NSString stringWithFormat:@"NEW VOIP CALL"];
notification.alertBody =alertBody;
notification.alertAction = @"Answer";
notification.soundName = @"56 Alarm Bell.mp3";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.