iOS有“通知监听器”吗? [英] Does iOS have a 'Notification Listener'?

查看:170
本文介绍了iOS有“通知监听器”吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在iOS中创建通知侦听器?像 NotificationListenerService 中的 Android

Is it possible to create a Notification Listener in iOS? Something like the NotificationListenerService in Android.

编辑:我要做的是收听来自设备内任何应用的任何通知(未接来电,电子邮件,短信......)

What I want to do is listen to any notifications coming from any app within the device (missed calls, emails, SMS...)

推荐答案

有两种可能的答案。

NSNotificationCenter 用于在应用程序内发布通知。比方说,你想要几个类都接收到某些事情发生的信息(或者其他什么)然后你会使用它。 https://developer.apple .com / library / mac / documentation / Cocoa / Reference / Foundation / Classes / nsnotificationcenter_Class / Reference / Reference.html

NSNotificationCenter is used to post notifications within the app itself. Say for instance you want several classes all to receive information that something has happened (or something) then you would use this. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsnotificationcenter_Class/Reference/Reference.html

如果你的意思是远程通知即推送从Apple收到的通知,然后AppDelegate会通过几种方式接收这些通知......

If you mean Remote Notifications i.e. push notifications that you receive from Apple then the AppDelegate receives these in a couple of its methods...

https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006786-CH3-SW16

编辑:应用之间无法实现。见评论。

It's not possible between apps. See comments.

这篇关于iOS有“通知监听器”吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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