Windows phone 7 Windows Phone 8中ScheduledAgent内的推送通知

Windows phone 7 Windows Phone 8中ScheduledAgent内的推送通知,windows-phone-7,windows-phone-8,push-notification,mpns,background-agent,Windows Phone 7,Windows Phone 8,Push Notification,Mpns,Background Agent,我想实现一个类似的任务,其中我想使用后台代理重新建立推送通知通道。可能吗 我在ScheduledAgent中使用以下代码,但它不起作用。如果我无法访问通道API,是否有其他选择?像whats应用程序和其他流行应用程序是如何做到这一点的?请帮帮我 你能给我一个替代方案吗?如果不使用这种方法,我如何更新我的用户,让他从我的服务器获得新的信息 protected override void OnInvoke(ScheduledTask task) { //TODO: A

我想实现一个类似的任务,其中我想使用后台代理重新建立推送通知通道。可能吗

我在ScheduledAgent中使用以下代码,但它不起作用。如果我无法访问通道API,是否有其他选择?像whats应用程序和其他流行应用程序是如何做到这一点的?请帮帮我

你能给我一个替代方案吗?如果不使用这种方法,我如何更新我的用户,让他从我的服务器获得新的信息

    protected override void OnInvoke(ScheduledTask task)
    {
        //TODO: Add code to perform your task in background
        HttpNotificationChannel pushChannel = HttpNotificationChannel.Find("HikeApp");
        if (pushChannel == null)
        {
            pushChannel = new HttpNotificationChannel("HikeApp");

            // Register for all the events before attempting to open the channel.
            pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
            pushChannel.Open();
            pushChannel.BindToShellTile();
            pushChannel.BindToShellToast();
        }
        else
        {
            // the channel was already open, so just register for all the events.
            pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
        }

        #if DEBUG_AGENT
        ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(1));
        #endif

        NotifyComplete();
    }
protected override void OnInvoke(ScheduledTask任务)
{
//TODO:添加代码以在后台执行任务
HttpNotificationChannel pushChannel=HttpNotificationChannel.Find(“HikeApp”);
if(pushChannel==null)
{
pushChannel=新的HttpNotificationChannel(“HikeApp”);
//在尝试打开通道之前注册所有事件。
pushChannel.ChannelUriUpdated+=新事件处理程序(pushChannel\u ChannelUriUpdated);
pushChannel.Open();
pushChannel.BindToShellTile();
pushChannel.BindToShellToast();
}
其他的
{
//频道已经打开,所以只需注册所有事件。
pushChannel.ChannelUriUpdated+=新事件处理程序(pushChannel\u ChannelUriUpdated);
}
#如果调试代理
ScheduledActionService.LaunchForTest(task.Name,TimeSpan.FromSeconds(1));
#恩迪夫
NotifyComplete();
}
根据的列表,无法在Microsoft.Phone.Notification命名空间中执行任何操作,该命名空间包括与推送通知有关的所有操作,来自计划代理