我可以实现一个有两种类型的通知的应用程序(远程和报亭通知) [英] can i implement an app that have 2 types of notification (Remote and newsstand notification)

查看:198
本文介绍了我可以实现一个有两种类型的通知的应用程序(远程和报亭通知)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道我是否可以实现一个可以处理两种类型通知的应用



谢谢

解决方案

远程和本地通知都允许应用程序以通知的形式通知其用户它有某些内容(信息)(可能是消息,即将发生的日历事件)当应用程序未在前台运行时,或远程服务器上的新数据)。



当操作系统显示时,本地和推送通知的外观和声音相同。他们可以显示警报消息,也可以标记应用程序图标。当显示警报或徽章编号时,他们也可以播放声音。



两者之间的区别是:




  • 本地通知由应用程序并由iOS在同一设备上提供。本地通知仅适用于iOS。

  • 推送通知(也称为远程通知)由应用程序的远程服务器(其提供商)发送到Apple推送通知服务,后者将通知推送到安装应用程序的设备。
    推送通知在iOS和iOS OS中均可用,从Mac OS X v10.7(Lion),Mac OS X开始。



<回到你的问题,答案是肯定的。



根据Apple文档中的讨论:



让iOS稍后发送本地通知,应用程序创建UILocalNotification对象,为其分配交付日期和时间,指定演示文稿详细信息并对其进行计划。要接收推送通知,应用程序必须注册才能接收通知,然后将其从操作系统获取的设备令牌传递给其提供商。



当操作系统提供本地通知(仅限iOS)或推送通知(iOS或Mac OS X)且目标应用程序未在前台运行,它会显示通知(警报,图标标记号,声音)。如果存在通知警报并且用户点击或单击操作按钮(或移动操作滑块),则应用程序将启动并调用方法以传入本地通知对象或远程通知有效内容。如果应用程序在传递通知时在前台运行,则应用程序代理会收到本地或推送通知。



有关进一步了解,请阅读有关本地和推送通知


i need to know if i can implement an app that can handle 2 types of notifications

Thanks

解决方案

Both remote and local notifications enable an application to inform its users that it has something (information) for them - in a form of a notification (It could be a message, an impending calendar event, or new data on a remote server), when the application isn't running in the foreground.

When presented by the operating system, local and push notifications look and sound the same. They can display an alert message or they can badge the application icon. They can also play a sound when the alert or badge number is shown.

The difference between the two are:

  • Local notifications are scheduled by an application and delivered by iOS on the same device. Local notifications are available in iOS only.
  • Push notifications, also known as remote notifications, are sent by an application’s remote server (its provider) to Apple Push Notification service, which pushes the notification to devices on which the application is installed. Push notifications are available in both iOS and, beginning with Mac OS X v10.7 (Lion), Mac OS X.

Going back to your question, the answer is YES.

As per discussed in the Apple documentation:

To have iOS deliver a local notification at a later time, an application creates a UILocalNotification object, assigns it a delivery date and time, specifies presentation details, and schedules it. To receive push notifications, an application must register to receive the notifications and then pass to its provider a device token it gets from the operating system.

When the operating system delivers a local notification (iOS only) or push notification (iOS or Mac OS X) and the target application is not running in the foreground, it presents the notification (alert, icon badge number, sound). If there is a notification alert and the user taps or clicks the action button (or moves the action slider), the application launches and calls a method to pass in the local-notification object or remote-notification payload. If the application is running in the foreground when the notification is delivered, the application delegate receives a local or push notification.

For further understanding, read more about Local and Push Notifications.

这篇关于我可以实现一个有两种类型的通知的应用程序(远程和报亭通知)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆