简体   繁体   English

使用Sencha Touch Windows Phone应用程序+ Windows Azure移动服务+自定义后端推送通知

[英]Push notifications using Sencha Touch Windows Phone app + Windows Azure Mobile Services + Custom backend

I'm trying to get Push notifications working in my Sencha Touch app which will be targeted to Windows Phone, iOS and Android. 我正在尝试在我的Sencha Touch应用程序中使用推送通知,该应用程序将针对Windows Phone,iOS和Android。 At the moment, I'm focussing on getting device registration to work inside the Windows Phone app. 目前,我专注于使设备注册在Windows Phone应用程序中运行。

Please note: We have an existing ASP.NET backend inside a Windows Azure Cloud Service. 请注意:Windows Azure云服务内部有一个现有的ASP.NET后端。

I have installed the Sencha Touch Extensions for Windows Azure and I have installed the PhoneGap PushPlugin into my Sencha app 我已经安装了适用于Windows AzureSencha Touch扩展,并且已经将PhoneGap PushPlugin安装到了我的Sencha应用程序中

I've followed all the instructions at the Windows Azure website on setting up the Ext.Azure plug-in. 我已按照Windows Azure网站上有关设置Ext.Azure插件的所有说明进行操作

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. 我知道在桌面浏览器中运行时不会发生设备注册,因此我已经在Windows Phone设备上运行了我的应用程序。...但是,什么也没有发生...没有设备注册发生。

Here's the relevant Sencha Controller code: 这是相关的Sencha控制器代码:

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. 我已经扎根了所有代码,无法弄清楚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. WP8内部似乎没有任何与iOS和Android端的PhoneGap PushPlugin等效的本机代码。 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). 我认为然后可以通过对Ext.Azure javascript插件内的MPNS的REST调用直接完成注册(尽管我无法在源代码中找到此调用)。

Either way, I cannot figure out how to do WP device registration inside a Sencha app. 无论哪种方式,我都无法弄清楚如何在Sencha应用程序中注册WP设备。 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. 另外,由于我们已经拥有一个后端,因此我可能不会使用Azure移动服务,并且认为使用Azure SDK使用来自Cloud Service的Service Bus通知中心更加有意义。 So I'm really only using Ext.Azure for the normalisation of the device registration. 因此,我实际上仅使用Ext.Azure进行设备注册的标准化。

Given that I already have a Cloud Service backend, do I need Azure Mobile Services? 鉴于我已经有一个Cloud Service后端,是否需要Azure移动服务? The only reason I can think of for needing that is if the device registration for WP8 goes via mobile service. 我能想到的唯一原因是WP8的设备注册是否通过移动服务进行。

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? 在我的Sencha应用程序的推式配置中,有一个“频道名称”,我不知道从哪里获取? 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. 因此,对于如何最好地在WP8,Android和iPhone上为Sencha应用设置推送通知的任何建议,我将非常感激。

Thanks for your help 谢谢你的帮助

@Boomerangertanger is correct in pointing out that you need that particular branch for the Azure extensions to work on WP8. @Boomerangertanger指出您需要该特定分支才能使Azure扩展在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 . 显然,直到PGB正式支持WP8 ...这是PGB不再合并该叉目前仅处于测试阶段的支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM