简体   繁体   English

没有 APNS 的推送通知

[英]Push Notifications without APNS

I work perfectly with Push Notifications for iOS using APNS.我使用 APNS 与适用于 iOS 的推送通知完美配合。 So for some customers, I need an on-premise or local solution, where I could send notifications to the device without APNS and without dependence on the internet.因此,对于某些客户,我需要一个内部部署或本地解决方案,这样我就可以在没有 APNS 且不依赖互联网的情况下向设备发送通知。 Somebody knows?有人知道吗? can you help me?你能帮助我吗?

Not possible.不可能。 You cannot get notification from APNS without internet.没有互联网,您无法从 APNS 获得通知。

What you can do to accomplish this is you send message from your server to the app while it is in background mode and generate local notification accordingly.您可以做的是在后台模式下从服务器向应用程序发送消息并相应地生成本地通知。

Let me clarify your question.让我澄清你的问题。

"Locally" means: you got either no internet connection, a local network without connection to APNS OR the users simply did not register for push notifications. “本地”意味着:您要么没有互联网连接,要么没有连接到 APNS 的本地网络,要么用户根本没有注册推送通知。

1. iBeacon with Local Push Notification 1.带有本地推送通知的iBeacon

So, here is an alternative, and that's kind of NOT what it is basically used for, but as you may know.所以,这里有一个替代方案,这不是它的基本用途,但您可能知道。 iBeacons can be used to transport small data chunks, very very small ones. iBeacons 可用于传输小数据块,非常非常小的数据块。 If your users did enable location services, you could include these for your application to trigger certain events (in this case, a very small notification that users came into range of a point of interest).如果您的用户确实启用了位置服务,您可以为您的应用程序包含这些服务以触发某些事件(在这种情况下,用户进入兴趣点范围的非常小的通知)。 Downside: The application bundle requires either a static "notification text" to beacon mapping or you have to dynamically download the mapping from a web source, so you could update the notification's text.缺点:应用程序包需要一个静态的“通知文本”到信标映射,或者您必须从网络源动态下载映射,以便您可以更新通知的文本。

2. Bluetooth with Local Push Notification 2. 蓝牙本地推送通知

Another alternative would be to use bluetooth instead.另一种选择是改用蓝牙。 Devices could auto connect to your Bluetooth Station "Peripheral" - These devices now (with the help of your app) would register to a broadcasting characteristic of your Peripheral.设备可以自动连接到您的“外设”蓝牙站 - 这些设备现在(在您的应用程序的帮助下)将注册到您的外设的广播特性。 The peripheral could send messages to the registered devices.外围设备可以向注册的设备发送消息。 If now the device does receive such a broadcasted message, you could perform a local push.如果现在设备确实收到了这样的广播消息,您可以执行本地推送。 - Without any network connection, just with the help of bluetooth, which itself also requires user permissions, of course. - 无需任何网络连接,只需借助蓝牙,当然这本身也需要用户权限。

3. Internet Connection / Silent Push with Local Push Notification 3.互联网连接/带有本地推送通知的静默推送

If your application of course had a working internet connection, you could avoid the APNS from Apple and send your own notifications to the device as silent push notifications.如果您的应用程序当然有可用的互联网连接,您可以避免来自 Apple 的 APNS,并将您自己的通知作为静默推送通知发送到设备。

APNS works only with internet. APNS仅适用于互联网。 If you need to push a message to the user without internet one solution ( probably only solution currently ) is using SMS api.如果您需要在没有互联网的情况下向用户推送消息,一个解决方案(目前可能唯一的解决方案)是使用 SMS api。 But that requires user mobile number.但这需要用户手机号码。 Using URL Schema the user can open your app from the SMS message.使用URL Schema ,用户可以从 SMS 消息打开您的应用程序。

As of iOS 14 this is available through Local Push Connectivity , but you will require the App Push Provider entitlement that you must apply for specifying why you are unable to use APNS.从 iOS 14 开始,这可以通过Local Push Connectivity 获得,但是您需要申请 App Push Provider 权利,您必须申请该权利并指定您无法使用 APNS 的原因。

Apple sample code is available here . Apple 示例代码可在此处获得

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM