标签: localnotification

Phonegap中的本地通知

我想在我的iOS Phonegap应用中收到本地通知.我遵循了很多教程和代码但没有帮助.任何人都可以指导我.

ios localnotification phonegap-plugins cordova

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

使用swos使用ios的本地通知

我是swift的新手,我不知道如何实现本地通知我尝试了一些代码,但这并不完全正常,所以任何人都可以帮助在iOS使用中实现本地通知swift

ios localnotification swift

8
推荐指数
2
解决办法
4万
查看次数

如何对特定于区域设置的本地通知进行单元测试

我刚刚在我的应用中添加了本地通知。当应用区域设置regionCode(即Locale.current.regionCode)为“ US”或“ CA”时,才触发这些通知。我对语言环境感兴趣language

我还将要编写补充的测试用例,但是一旦我知道如何编写一个测试用例,其他的就自然而然地遵循了。

因此,我的问题是:如何将Locale注入测试中(请参阅参考资料testSuccessfulNotificationDelivery())?

LocalNotificationTests.swift

class LocalNotificationTests: XCTestCase {

    let notification1 = LocalNotification(toTriggerInSeconds: 5)
    let notification2 = LocalNotification(toTriggerInSeconds: 6)

    // This object manages LocalNotifications 
    // by building them into UNUserNotifications
    // and then scheduling them using UNUserNotificationCenter.
    let notificationManager = NotificationManager()

    func testSuccessfulNotificationDelivery() {

        // setup locale and use it for testing, somehow
        let  = Locale(identifier: "en_CA")

        // The answer to my question would …
Run Code Online (Sandbox Code Playgroud)

locale ios localnotification swift unusernotificationcenter

8
推荐指数
1
解决办法
311
查看次数

如何实现多个本地通知而不是swift 3的单个通知

我使用单一通知,这是我的代码:这是用于注册本地通知>>>

    func registerLocal() {
    let center = UNUserNotificationCenter.current()

    center.requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
        if granted {
            print("Yay!")
        } else {
            print("D'oh")
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这个函数来安排本地通知>>>

func scheduleLocal() {
    registerCategories()

    let center = UNUserNotificationCenter.current()

    // not required, but useful for testing!
    center.removeAllPendingNotificationRequests()

    let content = UNMutableNotificationContent()
    content.title = "good morning"
    content.body = "ttt123"
    content.categoryIdentifier = "alarm"
    content.userInfo = ["customData": "fizzbuzz"]
    content.sound = UNNotificationSound.default()

    var dateComponents = DateComponents()
    dateComponents.hour = 23
    dateComponents.minute = 18
    let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, …
Run Code Online (Sandbox Code Playgroud)

notifications localnotification swift3 ios10

7
推荐指数
2
解决办法
5120
查看次数

WatchOS App 4.0:如何安排本地通知

我的应用程序处于后台或非活动模式,然后本地通知不起作 我从未收到过关于观看的本地通知.

更新:少于3分钟安排本地通知它工作正常但超过3分钟它不起作用.那么如何解决这个问题呢?

据我所知,我的代码如下.

UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

// Objective-C
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
content.title = [NSString localizedUserNotificationStringForKey:@"Remider!" arguments:nil];
content.body = [NSString localizedUserNotificationStringForKey:@"Your watch is out of range" arguments:nil];
content.sound = [UNNotificationSound defaultSound];

// Time
// 15 min
double timer = 15*60;
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:time
                                                                                                repeats:NO];
// Actions
UNNotificationAction *snoozeAction = [UNNotificationAction actionWithIdentifier:@"Track"
                                                                          title:@"Track" options:UNNotificationActionOptionForeground];

// Objective-C
UNNotificationCategory *category = [UNNotificationCategory categoryWithIdentifier:@"UYLReminderCategory"
                                                                          actions:@[snoozeAction] intentIdentifiers:@[]
                                                                          options:UNNotificationCategoryOptionCustomDismissAction];
NSSet *categories = [NSSet setWithObject:category];

// Objective-C …
Run Code Online (Sandbox Code Playgroud)

objective-c watch ios localnotification

7
推荐指数
1
解决办法
595
查看次数

Flutter:如何向本地通知添加按钮

我已经可以显示本地通知,但是在通知下方是否可以显示按钮?

(请参阅所附图片中的“延后”和“关闭”按钮)。

在此处输入图片说明

localnotification dart flutter

7
推荐指数
1
解决办法
506
查看次数

MissingPluginException(在频道 dexterous.com/flutter/local_notifications 上找不到方法显示的实现)

我已经尝试使用 Flutter 实现 Firebase Cloud Messaging,并且在我使用“本地通知”插件显示通知之前我是成功的

我的通知在前台工作正常,但在后台显示此错误:

[错误:flutter/lib/ui/ui_dart_state.cc(157)] 未处理的异常:MissingPluginException(在频道 dexterous.com/flutter/local_notifications 上找不到方法显示的实现)

我使用 Firebase Cloud Messaging 6.0.9、Local Notification 1.2.0+4 和最新的 Flutter

这是我的代码: NotificationHandler

import 'package:flutter_local_notifications/flutter_local_notifications.dart';

class NotificationHandler{
  static final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); // make it a static field of the class

  static void initNotification()
  {

// initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
    var initializationSettingsAndroid = AndroidInitializationSettings('@mipmap/ic_launcher');
    var initializationSettingsIOS = IOSInitializationSettings(
        onDidReceiveLocalNotification: onDidReceiveLocalNotification);
    var initializationSettings = InitializationSettings(
        initializationSettingsAndroid, initializationSettingsIOS);
    flutterLocalNotificationsPlugin.initialize(initializationSettings, …
Run Code Online (Sandbox Code Playgroud)

localnotification firebase flutter flutter-dependencies

7
推荐指数
2
解决办法
7096
查看次数

UILocalNotification最大差异

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

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

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

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

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

ios4 ios localnotification uilocalnotification

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

如何安排Android本地通知?

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

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

notifications datetime android localnotification

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

在iOS中的不同时间每天实现多个本地通知的逻辑

实际上,我正在开发一个应用程序,可以在日出和日落时间触发本地通知(每天都有所不同,所以不能使用闹钟).另外,我需要脱机使用此功能.

我已经尝试过了:

  • 立即注册全年通知,但由于通知限制限制,它不起作用
  • 在当前通知的触发事件上注册下一个通知,但是当设备关闭时没有触发通知时,此逻辑会失败.

任何帮助,将不胜感激.:)

notifications ios localnotification

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