【问题标题】:Callback function on launching app from notification with Cordova and Urban Airship使用 Cordova 和 Urban Airship 从通知启动应用程序的回调函数
【发布时间】:2015-07-31 09:43:57
【问题描述】:
有点困惑。我已经通过通知和我的 Cordova 应用启动并运行 Urban Airship。
我想知道的是,是否有办法确定在按下或收到通知时应用程序是在前台还是后台。
也许这甚至不是 Urban Airship 的事情,也许它只是在收到通知时确定应用程序状态?
无论如何,有点困惑和帮助将不胜感激。
【问题讨论】:
标签:
cordova
push-notification
apple-push-notifications
google-cloud-messaging
urbanairship.com
【解决方案1】:
所以这是确定应用程序状态和调用正确的 Urban Airship 函数的组合,这就是我的工作方式:
document.addEventListener('resume', function() {
UAirship.getLaunchNotification(true, onLaunchedFromPush);
});
function onLaunchedFromPush(event) {
//Do whatever you want in here
};