推送通知Sencha Touch 2 [英] Push Notification Sencha Touch 2

查看:103
本文介绍了推送通知Sencha Touch 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用sencha touch 2开发IOS应用程序,我有发送推送通知的要求。我已经设置了苹果证书文件,临时配置文件也做了一些服务器端编码来实现这一点。但不知道在sencha有什么推送通知服务吗?我该如何实现这个?我应该使用PhoneGap吗?
请指示我正确的方向..你的帮助是非常感谢。感谢提前

Am Developing an IOS application using sencha touch 2, i have a requirement of sending push notification . I have set apple certificate file, provisional profile also did some server side coding to achieve this. But not sure about is there any push notification service in sencha ? How can i achieve this... Should i use PhoneGap? Please direct me in right direction.. Your help is much appreciated. Thanks in advance

推荐答案

感谢每一个人指导我正确的方向。我使用sencha native Device功能发送推送通知。它不会在Android中工作。我实现了如下的方式。我把这段代码放在我的app.js文件中。你会得到设备令牌。将设备令牌发送到您的服务器。您可以使用此设备令牌配置推送通知

Thanks every one for guiding me in right direction. I used sencha native Device function to send push notification. It will not work in android. I achieved like the following way. I put this code in my app.js file . You will get the device token there. Sent the device token to your server . There you can configure push notification using this device token

Ext.device.Push.register({
            type: Ext.device.Push.ALERT|Ext.device.Push.BADGE|Ext.device.Push.SOUND,
            success: function(token) {
                console.log('# Push notification registration successful:');
                console.log('token: ' + token);
                WinReo.app.devicetokenid = token;
                WinReo.app.platform = Ext.device.Device.platform;
                //Ext.Msg.alert('Title', WinReo.app.platform +'', Ext.emptyFn);
            },
            failure: function(error) {
                console.log('# Push notification registration unsuccessful:');
                console.log('     error: ' + error);
            },
            received: function(notifications) {
                console.log('# Push notification received:');
                console.log('    ' + JSON.stringify(notifications));
            }
        });

当您首次打开该应用程序时,我会询问这个应用是否允许推送通知消息。在那里你可以选择是/否。稍后,您可以通过设备中的设置/通知来编辑此设置。

When u first open the app, i will ask whether this app allow push notification message. There you can select yes/no. Later you can edit this setting by go to settings/notification in device.

这篇关于推送通知Sencha Touch 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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