Estimote iBeacons和Cordova - 当应用程序被杀死iOS时发送推送通知 [英] Estimote iBeacons and Cordova - sending push notifications when app is killed iOS

查看:304
本文介绍了Estimote iBeacons和Cordova - 当应用程序被杀死iOS时发送推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Apache Cordova与Evothings Javascript插件和Estimote iBeacons制作应用程序。我已经设法获得推送通知与Phonegap PushPlugin ,当应用程序是int eh后台(没有完全关闭),但是我想进一步,并在iBeacons范围内,当应用程序完全杀死时收到推送通知。

I'm making an app with Apache Cordova with Evothings Javascript plugin and Estimote iBeacons. I've managed to get push notifications working with the Phonegap PushPlugin when the app is int eh background (not completely closed), however I want to take it a step further and receive a push notification when in range of the iBeacons when the app is completely killed.

看到这是可能从Estimote社区中的各种帖子和这里的堆栈溢出通过使用本机Xcode开发,但只是没有使用Cordova / Evothings Javascript SDK。

I've seen this is possible from various posts in the Estimote community and here on Stack overflow by using native Xcode development, but just not using the Cordova/Evothings Javascript SDK.

我的应用程式目前正在执行 EstimoteBeacons.startMonitoringForRegion()函式,

My app currently runs the EstimoteBeacons.startMonitoringForRegion() function which does work in the background when the app is closed, but just doesn't seem to run any code at all when the app is killed.

我试过运行 EstimoteBeacons.requestAlwaysAuthorization() ;

I've tried running EstimoteBeacons.requestAlwaysAuthorization(); which also doesn't do anything.

我也尝试过使用Cordova 本地通知插件,它再次没有工作,当应用程序被杀死,这让我相信没有代码甚至得到执行时,应用程序

I also tried using the Cordova local notification plugin which again didn'tg work when the app was killed, which leads me to believe that no code even gets executed when the app is completely closed.

如果任何人可以说出一些亮点,我将非常感激。

If anyone can shed some light on this I would appreciate.


推荐答案

当应用程序不在iOS上运行时,这个工作的关键是创建一个原生的AppDelegate类,也是 CLLocationManager 接收 didEnterRegion 回调。至关重要的是,CoreLocation的委托是应用程序的中心AppDelegate,以使操作系统启动应用程序。

The key to making this work when the app is not running on iOS is to make a native AppDelegate class that is also the delegate for CLLocationManager to receive didEnterRegion callbacks. It is critical that the delegate for CoreLocation be the app's central AppDelegate in order to get the OS to launch the app.

我不熟悉Cordova在iOS上知道如何将一个插件或其他本地接口层绑定到本机AppDelegate。解决这个问题是使其工作的关键。

I am not familiar enough with Cordova on iOS to know how to bind a plugin or other native interface layer to the native AppDelegate. Solving this problem is the key to making it work.

这篇关于Estimote iBeacons和Cordova - 当应用程序被杀死iOS时发送推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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