1
votes

I'm trying to get Push notifications working in my Sencha Touch app which will be targeted to Windows Phone, iOS and Android. At the moment, I'm focussing on getting device registration to work inside the Windows Phone app.

Please note: We have an existing ASP.NET backend inside a Windows Azure Cloud Service.

I have installed the Sencha Touch Extensions for Windows Azure and I have installed the PhoneGap PushPlugin into my Sencha app

I've followed all the instructions at the Windows Azure website on setting up the Ext.Azure plug-in.

I understand that device registration will not happen when running inside a desktop browser, so I've run my app on my Windows Phone device.... however, nothing happens... no device registration occurs.

Here's the relevant Sencha Controller code:

init: function () {

    Ext.Azure.on({
        scope: this,
        'pushregistrationsuccess': this.onPushRegistrationSuccess,
        'pushregistrationfailure': this.onPushRegistrationFailure,
        'pushnotification': this.onPushNotification
    });
},

onPushRegistrationFailure: function (event, opts) {
    alert("The push registration failed");
},

onPushRegistrationSuccess: function (event) {
    alert("onPushRegistrationSuccess: " + event);
},

onPushNotification: function (event) {
    Ext.Msg.alert('Notification', event.message);
},


launch: function (app) {
    //debugger;
    Ext.Azure.init({
        appKey: 'xxxxxxxxxxxxxxxxxx',
        appUrl: 'xxxxxxxxx.azure-mobile.net',
        pushConfig : {
            windowsphone : 'channel_name',
            android      : 'sender_id',
            ios          : true
        }
    });

}

I've rooted through all the code and I cannot figure out how the device registration side is done within Windows Phone. There doesn't appear to be any native code inside the WP8 that equates to the PhoneGap PushPlugin stuff on the iOS and Android side. I assume then that registration is done via a REST call directly to MPNS within the Ext.Azure javascript plugin (although I cannot find this call in the source code).

Either way, I cannot figure out how to do WP device registration inside a Sencha app. Also, I'm probably not going to be using Azure Mobile services, as we already have a backend and think it would make more sense to use a Service Bus notification hub from the Cloud Service using the Azure SDK. So I'm really only using Ext.Azure for the normalisation of the device registration.

Given that I already have a Cloud Service backend, do I need Azure Mobile Services? The only reason I can think of for needing that is if the device registration for WP8 goes via mobile service.

I'm very confused by this entire thing. In the push config for my Sencha app, there's a "channel name", I have no idea where to get this from? But hey, I figure that if it's wrong, I should still be able to make the device registration call.

So any advice about how to best set-up push notifications for a Sencha app across WP8, Android and iPhone where there's an existing cloud service I'd be very grateful.

Thanks for your help

1
Looks like there's an error in Sencha / Microsoft's documentation, they said to install the Cordova / PhoneGap PushPlugin from github (github.com/phonegap-build/PushPlugin) but this doesn't have a vital WP8 module (cordovalib\commands\PushPlugin.cs). In reality you need to install a branch (github.com/darkphantum/PushPlugin) which does have this file.krisdyson

1 Answers

0
votes

@Boomerangertanger is correct in pointing out that you need that particular branch for the Azure extensions to work on WP8. I'll try to make a note of that in our guide in the next release.

Apparently PGB won't merge that fork until PGB officially supports WP8... which is currently only in beta support.