是否可以在 iOS 上发送 SILENT LOCAL 通知 [英] Is it possible to send SILENT LOCAL notification on iOS

查看:22
本文介绍了是否可以在 iOS 上发送 SILENT LOCAL 通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用从挂起模式中唤醒来自服务器的静默远程通知,完全符合我的要求.该服务器发送带有content-available:1"的推送通知,它完成了这项工作.

My app wakes up from suspended mode on silent remote notification from a server, exactly as I want. This server sends a push notification with "content-available:1", which does the job.

现在我想在没有服务器帮助的情况下执行此操作,因此我想发送无声本地通知(来自应用程序)在未来的某个时间(就像 15 分钟后一样),但找不到设置内容可用:1"的方法.因此,我最终会收到本地通知,但不会唤醒我的应用程序,就像使用远程通知一样.

Now I want to do this without the help of a server and so I want to send silent local notifications (from the app) at a time in the future (like after 15 min.), but can't find a way to set "content-available:1". So I end up getting local notification that doesn't wake up my app, as I can with remote notification.

我搜索了一些信息,我能找到的只是交互式通知的示例以及如何设置标题、正文、警报和触发器(基于位置、日期等).但没有关于如何设置 content-available 属性.

I've searched for information and all I can find are examples of interactive notifications and how to set title, body, alert and triggers (based on location, date and so on.). But nothing about how to set content-available property.

那么,是否可以为本地通知设置内容可用?

So, is possible to set content-available for local notifications?

推荐答案

如果没有用户干预,这只是不可能.没有 Android 的 AlarmManager 类型的解决方案可以将应用程序从 iOS 中的挂起模式唤醒.在 iOS 中,除了远程推送通知(如果外部应用程序定期发送推送通知)之外,无法定期从挂起模式唤醒应用程序.

It's just not possible without user intervention. There is no Android's AlarmManager kind of solution to wake up the app from suspended mode in iOS. In iOS there's no way to periodically wake up app from suspended mode, except from remote push notification (if an extern application sends a push notification periodically).

这篇关于是否可以在 iOS 上发送 SILENT LOCAL 通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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