从iOS 5开始,有两种通知样式:横幅和警报("旧"样式).用户可以在设置中设置要为每个应用程序使用的样式.但是,现在默认似乎是通知显示横幅样式.
我正在使用本地通知来提醒"现在"发生的事件.一个横幅在它出现后不久就消失了(并且它不够明显,人们可以点击它),所以对于这些通知,需要将警报样式通知保留在屏幕上直到用户决定一个动作(忽略或去到应用程序).
有没有办法通过代码或例如Info.plist
条目告诉iOS默认情况下应该使用警报样式通知(只要用户没有配置其他东西)?
更新:缺乏信息/文件是不足以让我解决这个问题.我想要一个像权威人士的论坛/博客文章(Apple员工或Erica Sadun的人)说这是不可能的,或者如果有可能那么我想要解决方案.像"要求用户更改设置"这样的解决方法也不够好.
我已经在互联网上查看了如何使用IOS 8创建本地通知.我发现了许多文章,但没有解释如何确定用户是否已设置"警报"开启或关闭.请有人帮帮我!!! 我更喜欢使用Objective C over Swift.
我正在制作一个iPhone应用程序,它需要本地通知.
在本地通知中有repeatInterval属性,我们可以将单位重复间隔设置为分钟,小时,日,周,年等.
我希望重复间隔应该是4个小时.
所以每4小时就有一次本地通知.
我不希望用户为每个设置单独的通知.
我希望用户能够将repeatInterval设置为4小时.
我怎么做?
iphone cocoa-touch ios4 localnotification uilocalnotification
iPhone版 - 5.1(9B176)
下面是本地通知期间的一系列事件,其中didFinishLaunchingWithOptions
未调用哪种方法.
根据Apple文档预期:
作为所呈现的通知的结果,用户点击警报的动作按钮或点击(或点击)应用程序图标.如果点击操作按钮(在运行iOS的设备上),系统将启动应用程序,应用程序将调用其委托
didFinishLaunchingWithOptions
方法(如果已实现); 它传递通知有效负载(用于远程通知)或本地通知对象(用于本地通知).如果在运行iOS的设备上轻触应用程序图标,则应用程序会调用相同的方法,但不会提供有关通知的信息
实际:未
didFinishLaunchingWithOptions
调用.但applicationWillEnterForeground
和applicationDidBecomeActive
被调用.
iphone notifications localnotification uilocalnotification ios5
似乎有四种不同的第三方插件可以完成phonegap构建中列出的本地通知:
https://github.com/GotCakes/Phonegap-LocalNotification/
https://github.com/javamrright/cordova-plugin-local-notifications/
https://github.com/simplec-dev/LocalNotification/
https://github.com/katzer/cordova-plugin-local-notifications/
(来自https://build.phonegap.com/plugins)
我一直在使用四个中的最后一个(de.appplant.cordova.plugin.local-通知),但我很想知道(1)其他包是否是首选解决方案和(2)为什么有phonegap/cordova内的四个独立项目完成同样的任务......?
我正在使用 flutter 本地通知在我的应用程序中显示日程通知。但不幸的是,当应用程序处于终止状态时它不起作用。
这是我的代码:
class Notifications {
static final FlutterLocalNotificationsPlugin _notifications =
FlutterLocalNotificationsPlugin();
static Future<NotificationDetails> _notificationDetails() async {
return const NotificationDetails(
android: AndroidNotificationDetails(
'weekly notification channel id',
'weekly notification channel name',
channelDescription: 'weekly notification description',
playSound: true,
sound: RawResourceAndroidNotificationSound('azan1'),
importance: Importance.high,
),
iOS: IOSNotificationDetails(sound: 'azan1.mp3', presentSound: true));
}
static void init() async {
tz.initializeTimeZones();
const AndroidInitializationSettings android =
AndroidInitializationSettings('@mipmap/ic_launcher');
const IOSInitializationSettings iOS = IOSInitializationSettings();
InitializationSettings settings =
const InitializationSettings(android: android, iOS: iOS);
await _notifications.initialize(settings);
final String locationName = await FlutterNativeTimezone.getLocalTimezone(); …
Run Code Online (Sandbox Code Playgroud) 我的应用程序从服务器静默远程通知的挂起模式唤醒,正如我想要的那样.此服务器发送带有" content-available:1" 的推送通知,该通知执行该作业.
现在我想在没有服务器帮助的情况下这样做,所以我想在将来的某个时间发送静音本地通知(来自应用程序)(比如15分钟后),但找不到设置的方法内容可供选择:1" .所以我最终得到的本地通知并没有唤醒我的应用程序,因为我可以使用远程通知.
我搜索了一些信息,我所能找到的只是交互式通知的示例,以及如何设置标题,正文,警报和触发器(基于位置,日期等).但没有关于如何设置内容可用属性.
那么,是否可以为本地通知设置内容?
apple-push-notifications ios localnotification silent-notification
从iOS9开始,本地通知无法正常工作.有时用户会收到通知,有时他们却没有收到通知.我的通知每天重复.知道可能导致问题的原因吗?我看到一些帖子,iOS9中有一个错误,但我不确定是什么原因.
这是一段代码:
NSDate *alarmDate = [date dateByAddingTimeInterval:DEFAULT_SNOOZE_DURATION * i];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = alarmDate;
localNotif.timeZone = nil;
localNotif.alertBody = alertBody;
localNotif.hasAction = YES;
localNotif.applicationIconBadgeNumber = 1;
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.repeatInterval = NSCalendarUnitDay;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif]
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
我flutter_local_notifications: ^0.7.1+3
在我的 Flutter 应用程序中使用来推送日程通知。一切都很好,但我的通知正文中的问题是它只显示一行文本,我无法扩展或拉伸通知以显示所有通知正文文本。
这是我的尝试:
class NotificationUtil {
final notifications = FlutterLocalNotificationsPlugin();
final int checkOutNotifyId = 0;
NotificationUtil(BuildContext context) {
final settingsAndroid = AndroidInitializationSettings('ic_notify_icon');
final settingsIOS = IOSInitializationSettings(
onDidReceiveLocalNotification: (id, title, body, payload) =>
onSelectNotification(context));
notifications.initialize(
InitializationSettings(settingsAndroid, settingsIOS),
onSelectNotification: (context) async => onSelectNotification);
}
Future<void> showCheckOutNotify([int maximumCheckoutHours]) async {
await notifications.periodicallyShow(
checkOutNotifyId,
AttendanceConstants.SCHEDULE_NOTIFICATION_TITLE,
AttendanceConstants.SCHEDULE_NOTIFICATION_BODY +
'$maximumCheckoutHours Hour/s of your attendance',
RepeatInterval.Hourly,
_ongoing);
}
NotificationDetails get _ongoing {
final androidChannelSpecifics = AndroidNotificationDetails(
'your channel id',
'your channel name',
'your …
Run Code Online (Sandbox Code Playgroud) 我正在使用flutter_local_notifications库每 1 小时安排一次本地通知。它正在按预期工作,但现在,我需要一种方法来启动/停止通知计划(例如,按下按钮)。
我在文档中找不到有关取消预定通知请求的任何内容。