标签: localnotification

UILocalNotification最大差异

在Apple的本地和推送通知编程指南中,它说:

设备上的每个应用程序仅限于最快的64个预定本地通知.操作系统会丢弃超出此限制的通知.它将重复通知视为单个通知.链接

但是,它在iOS应用程序编程指南中

清单4-3显示了一个使用用户设置的日期和时间来安排单个警报的示例.此示例一次仅配置一个警报,并在安排新警报之前取消之前的警报.(您自己的应用程序在任何给定时间都可以激活不超过128个本地通知,其中任何一个都可以配置为以指定的时间间隔重复.)LINK

以下哪一项是正确的?我可以收到64个通知或128个通知吗?

ios4 ios localnotification uilocalnotification

6
推荐指数
1
解决办法
1455
查看次数

从本地通知启动已关闭的iOS应用程序

当我的iOS应用程序在后台运行时,它可以很好地响应

 - (void)application:(UIApplication *)application didReceiveLocalNotification:
    (UILocalNotification *)notification
Run Code Online (Sandbox Code Playgroud)

但是当应用程序关闭时,它会崩溃并发出SIGKILL错误.

如果在收到通知时关闭了应用程序,如何在应用程序中运行该方法?

ios localnotification uilocalnotification

6
推荐指数
2
解决办法
5431
查看次数

在特定日期重复UILocalNotification

我需要设置UILocalNotification,我只需要从DatePicker获取小时和分钟,并需要设置特定日期 (如:星期一)并在每个星期一重复.

我有两个问题:

第一 ; 是否可以在日期选择器的日期部分仅显示"日期名称",如"星期日"?

第二个问题是; 如果我想设置本地通知的具体日期,那么正确的代码是什么?

谢谢你的答案,下面是我的代码;

-(IBAction) alarmButton:(id)sender {

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.timeZone = [NSTimeZone defaultTimeZone];
dateFormatter.timeStyle = NSDateFormatterShortStyle;
dateFormatter.dateStyle = NSDateFormatterShortStyle;

NSString *dateTimeString = [dateFormatter stringFromDate: dateTimePickerSet1.date];
NSLog ( @"Alarm Set :%@" , dateTimeString);

[self scheduleLocalNotificationWithDate1: dateTimePickerSet1.date];

}

-(void)scheduleLocalNotificationWithDate1:(NSDate *)fireDate {
UILocalNotification *notification = [[UILocalNotification alloc] init];

notification.fireDate = fireDate;
notification.alertBody = @"Alarm Set !";

[[UIApplication sharedApplication] scheduleLocalNotification:notification];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c datepicker ios localnotification

6
推荐指数
1
解决办法
3797
查看次数

如何安排Android本地通知?

我对Android中的本地通知有疑问.我正在开发一个应用程序,其中第一部分必须接收我自己的服务器公司的所有会议(我已经实现),第二部分我必须在每次会议前一天通知,但有本地通知.

如何在给定日期安排本地通知?

notifications datetime android localnotification

6
推荐指数
1
解决办法
1万
查看次数

使用phonegap cordova每天安排本地通知

我正在开发一个带有cordova的应用程序,我正在使用这个插件来安排每天到6点的本地通知 https://github.com/katzer/cordova-plugin-local-notifications

一切正常,这是我用来设置de Notification的代码

/*Set 6 o'clock*/
function setTestAlarm() {
    var notify = new Date();
    notify.setHours(18,00,00,00);

  localNotification.add({
        id:      1,
        title:   'My app',
        message: 'Hi this is a notification',
        repeat:  'daily',
        date:    notify,
        autoCancel: true, 
        ongoing: true, 
    });
Run Code Online (Sandbox Code Playgroud)

我正在进行测试,并且通知每天下午6点出现,但仅连续9天,然后停止出现.我究竟做错了什么?

谢谢

notifications localnotification phonegap-plugins cordova

6
推荐指数
1
解决办法
5031
查看次数

管理您的应用已安排的本地通知的好方法是什么?

我正在深入研究iOS开发,并且一直在研究闹钟应用程序以熟悉iOS平台和SDK.我正在使用本地通知处理我的警报,但我需要一些管理我设置的本地通知的方法,以便在我编辑或删除与它们相关的任何警报时可以更新它们.我想出了如何在计划cancelLocalNotification:后使用函数取消计划本地通知,但我很难弄清楚如何检索与编辑或删除的警报关联的本地通知对象,以便我可以使用该功能.我应该注意,用于创建本地通知的所有警报对象都存储在Core Data DB中,其界面定义为......

@interface Alarm :  NSManagedObject  
{
}

@property (nonatomic, retain) NSNumber * Snooze;
@property (nonatomic, retain) NSNumber * AlarmID;
@property (nonatomic, retain) NSString * Label;
@property (nonatomic, retain) NSDate * Repeat;
@property (nonatomic, retain) NSDate * Time;
@property (nonatomic, retain) NSNumber * Enabled;
@property (nonatomic, retain) NSString * Song;
@property (nonatomic, retain) NSString * Sound;

@end
Run Code Online (Sandbox Code Playgroud)
  1. 管理我的应用程序计划的本地通知的好方法是什么,以便我以后可以检索那些本地通知对象并在需要时重新安排它们?
  2. 有没有办法检索您的应用程序已安排的本地通知?
  3. 如果是这样,有没有办法独特地识别它们?

非常感谢您的帮助!

iphone cocoa-touch ipad ios localnotification

5
推荐指数
1
解决办法
2953
查看次数

如何在Ionic中更改android本地通知图标?

我正在使用ionic来构建android应用。我正在使用 $cordovaLocalNotification本地通知。通知有效,但显示默认的响铃图标。如何自定义通知图标?

android localnotification cordova cordova-plugins ionic

5
推荐指数
1
解决办法
6421
查看次数

本地通知抖动

任何人都可以向我展示如何使用本地通知插件在颤振中安排通知的代码。尝试了 git 存储库中的示例,购买它对我不起作用,尽管正常通知正在工作,但我如何将其安排在特定时间,例如提醒?

schedule localnotification flutter

5
推荐指数
1
解决办法
1万
查看次数

flutter 本地通知在 IOS 上不起作用

我正在使用 flutter 应用程序设置 fcm,并使用本地通知在应用程序位于前台时显示通知。

在 android 中它运行完美,没有任何错误。但在 IOS 上本地通知不起作用。它没有显示错误或任何内容,但是当应用程序位于前台时,它现在根本显示通知横幅

这是本地通知的设置:

var android = AndroidInitializationSettings('mipmap/ic_launcher');
var ios = IOSInitializationSettings();
var platform = new InitializationSettings(android, ios);
flutterLocalNotificationsPlugin.initialize(platform);
_firebaseMessaging.requestNotificationPermissions(
 const IosNotificationSettings(sound: true, badge: true, alert: true, provisional: false));
Run Code Online (Sandbox Code Playgroud)

然后是 showNotification 函数,如下所示:

 showNotification(Map<String, dynamic> message) async {
var android = new AndroidNotificationDetails(
    'IMPORTANT1', 'SHOW BANNER', 'ALWAYS SHOWS BANNER',
    importance: Importance.Max, priority: Priority.High, ticker: 'ticker');
var ios = new IOSNotificationDetails();
var platform = NotificationDetails(android, ios);
await flutterLocalNotificationsPlugin.show(
    0,
    message['notification']['title'],
    message['notification']['body'],
    platform); }
Run Code Online (Sandbox Code Playgroud)

我通过互联网搜索并发现我需要使用这个

if #available(iOS …
Run Code Online (Sandbox Code Playgroud)

localnotification flutter

5
推荐指数
1
解决办法
6263
查看次数

如果从 Core Data SwiftUI 中删除,则删除本地通知

我编写了这个简单的代码来尝试本地通知如何与核心数据一起工作,主要问题是,在添加数据核心项目后,我可以在 60 秒后收到我的通知,但如果我删除它,我仍然会收到它。当我调用 deleteItem 函数时,是否可以调用一个函数来删除该特定通知?

我的另一个问题是如何设置星期几和触发该通知的时间,而不是在几秒钟后重复?

内容视图:

import UserNotifications
import SwiftUI
import CoreData

struct ContentView: View {
    //Core Data
    @Environment(\.managedObjectContext) var managedObjectContext
    @FetchRequest(entity: Notifications.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \Notifications.date, ascending: false)]) var notifications: FetchedResults<Notifications>
    
    var titles = ["Hello", "Weekend", "Streaming", "ScoobyDoo"]
    var subtitles = ["Hello2", "Weekend2", "Streaming2", "ScoobyDoo2"]
    
    var body: some View {
        NavigationView {
            VStack {
                NavigationLink(destination: FavoriteView()) {
                    Text("Favorite View")
                }
                List {
                    ForEach(0 ..< titles.count) {title in
                        HStack {
                            Text(self.titles[title])
                            Image(systemName: "heart")
                                .onTapGesture {
                                    if self.checkItem(title: self.titles[title]) {
                                        do …
Run Code Online (Sandbox Code Playgroud)

core-data localnotification uilocalnotification swift swiftui

5
推荐指数
1
解决办法
266
查看次数