仅在IOS中前台运行App时获取Appcelerator Titanium推送通知 [英] Get Appcelerator Titanium push notification while App in foreground in IOS only

查看:77
本文介绍了仅在IOS中前台运行App时获取Appcelerator Titanium推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have implemented Appcelerator Titanium push notification in my application (Android and IOS) for Message Receiving :

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

I am receiving notification in android on both when app is in background and foreground. I am using below property in android to show notification when app is in foreground (CloudPush.showTrayNotificationsWhenFocused = true;)

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

Problem: I am facing problem in IOS (version 9.1 iPhone5) while receiving Notification when app is in foreground. When app is in background, notification is showing in notification bar but when app is in foreground notification is not showing in notification bar for IOS.

请问有人可以帮我吗,当应用程序位于IOS的前台时,如何获得通知.

Please Can any one help me, how can I get notification when app is in foreground for IOS.

谢谢

推荐答案

看看在文档内部有一个回调:

Inside the documentation there is a callback:

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

这链接到此代码:

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

这也将在应用程序内部触发.

This will trigger also when inside the app.

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

Please follow the link above to set it up correctly. It might not work otherwise.

这篇关于仅在IOS中前台运行App时获取Appcelerator Titanium推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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