【问题标题】:Get Appcelerator Titanium push notification while App in foreground in IOS only仅在 IOS 中在前台应用时获取 Appcelerator Titanium 推送通知
【发布时间】:2016-06-13 18:49:22
【问题描述】:

我已经在我的应用程序(Android 和 IOS)中实现了 Appcelerator Titanium 推送通知来接收消息:

当应用程序处于后台和前台时,我都会在 android 中收到通知。我在 android 中使用以下属性在应用程序处于前台时显示通知(CloudPush.showTrayNotificationsWhenFocused = true;)

问题:当应用程序在前台时收到通知时,我在 IOS(版本 9.1 iPhone5)中遇到问题。 当应用程序在后台时,通知会显示在通知栏中,但当应用程序在前台时,通知不会显示在 IOS 的通知栏中。

请任何人帮助我,当应用程序在 IOS 的前台时,我如何获得通知。

谢谢

【问题讨论】:

    标签: ios push-notification titanium appcelerator


    【解决方案1】:

    查看Documentation 以获取推送通知。

    文档里面有一个回调:

        Ti.Network.registerForPushNotifications({
            success: deviceTokenSuccess,
            error: deviceTokenError,
            callback: receivePush
        });
    

    这个链接到这个代码:

    // Process incoming push notifications
    function receivePush(e) {
        alert('Received push: ' + JSON.stringify(e));
    }
    

    这也会在应用内触发。

    请按照上面的链接进行正确设置。否则可能无法正常工作。

    【讨论】:

    • 感谢 Rene 的帮助 :)
    猜你喜欢
    • 2013-01-30
    • 1970-01-01
    • 2014-11-28
    • 2018-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-15
    相关资源
    最近更新 更多