Push Notification Sencha Touch 2

匿名 (未验证) 提交于 2019-12-03 09:52:54

问题:

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

回答1:

YES, to make your iOS Sencha-Touch based application support notification, you should use a third party plugin such as mentioned in the documentation : -Sencha Packager -PhoneGap -Simulator

i used the PhoneGap implementation and in the app.js file i put the notifications related infos. when a notification is generated in the backend i send it to the right user based on the session's token stored on the moment of authentification:

Ext.Application({ ... //notifications Configuration notifications : {     storeTokenUrl   : 'https://adress/whereto/store/token/',     gcmsenderid     : '0123456789012',     appid       : 'apple_app_id',     title       : 'notification title' } }) 


回答2:

When i need to do Push Notification i was using sencha touch 2.0 (latest that time)

I used third party plugins like urbanairship, pushwoosh and it's good.

For these plugin you need to use PhoneGap.

Refer this links

cordova-push-notification

Building a Notification App for iOS with Sencha Touch and PhoneGap

Apple Push Notification Services in iOS 6 Tutorial



回答3:

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.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!