Dibish
Dibish

Reputation: 9293

Push Notification Sencha Touch 2

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

Upvotes: 1

Views: 3169

Answers (3)

Dibish
Dibish

Reputation: 9293

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.

Upvotes: 0

LdiCO
LdiCO

Reputation: 577

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'
}
})

Upvotes: 1

Viswa
Viswa

Reputation: 3211

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

Upvotes: 0

Related Questions