2

나는이 목표를 달성하는 데 정말로 어려움에 직면 해있다. 나는 PhoneGap 응용 프로그램을 개발 중이며 Android, iOS 및 Windows Phone에도이 응용 프로그램을 배포 할 것입니다.Windows 전화 용 Microsoft 푸시 알림 서비스에서 어떻게 인증합니까?

애플 통지 서비스 (APN)와 Google 클라우드 메시징을 아무런 문제없이 사용할 수 있었지만 Windows Phone 앱에서 똑같이하려고 할 때가 아주 어려웠습니다.

APN과 달리 GCM은 일부 코드를 생성하거나 푸시 알림 서비스로 내 앱을 통합 할 수있는 인증서를 다운로드 할 수있는 곳을 찾지 못했습니다.

내가 PHP http://phpwindowsphonepush.codeplex.com/

예와 윈도우 폰에 푸시 알림을 보내려면이 서비스를 사용하기 위해 노력하고있어 나에게이 $uri="http://db3.notify.live.net/throttledthirdparty/01.00/123456789123456798"; //uri sended by Microsoft plateform을 표시하지만 어떻게이 같은 URI를 얻기 위해 자신의 plataform에 등록을하나요 ?

또한이 PHP Windows Phone입니까? Windows Phone에서 토스트 및 타일 알림을 보내기위한 올바른 선택을 하시겠습니까? 설명서가 매우 혼란스럽고 서버 및 원시 코드 응용 프로그램을 구성하는 방법이 명확하지 않아 분실했습니다.

답변

3

알림 채널에 해당 URI가 있으며, APNS 장치 토큰 및 GCM 등록 ID와 동일한 MPNS입니다. 당신은 당신의 윈도우 폰 응용 프로그램 코드에서 그것을 얻을 수 있습니다

public MainPage() 
{ 
    /// Holds the push channel that is created or found. 
    HttpNotificationChannel pushChannel; 

    // The name of our push channel. 
    string channelName = "ToastSampleChannel"; 

    InitializeComponent(); 

    // Try to find the push channel. 
    pushChannel = HttpNotificationChannel.Find(channelName); 

    // If the channel was not found, then create a new connection to the push service. 
    if (pushChannel == null) 
    { 
     pushChannel = new HttpNotificationChannel(channelName); 

     // Register for all the events before attempting to open the channel. 
     pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated); 
     pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred); 

     // Register for this notification only if you need to receive the notifications while your application is running. 
     pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived); 

     pushChannel.Open(); 

     // Bind this new channel for toast events. 
     pushChannel.BindToShellToast(); 

    } 
    else 
    { 
     // The channel was already open, so just register for all the events. 
     pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated); 
     pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred); 

     // Register for this notification only if you need to receive the notifications while your application is running. 
     pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived); 

     // Display the URI for testing purposes. Normally, the URI would be passed back to your web service at this point. 
     System.Diagnostics.Debug.WriteLine(pushChannel.ChannelUri.ToString()); 
     MessageBox.Show(String.Format("Channel Uri is {0}", 
      pushChannel.ChannelUri.ToString())); 

    } 
} 

당신은 당신의 웹 서비스를 (인증되지 않은 웹 서비스는 하루 장치 당 500 메시지를 보낼 수 있습니다) 인증 필요는 없지만, 그렇게하는 것이 좋습니다 :

우리는 통신 더 나은 보안을 위해 HTTPS 인터페이스를 통해 발생하기 때문에 푸시 알림 서비스로 알림을 보낼 수있는 인증 된 웹 서비스를 설정하는 것이 좋습니다. 인증 된 웹 서비스는 푸시 알림의 수에 일일 제한이 없음 보낼 수 있습니다. 한편, 인증되지 않은 웹 서비스는 일 당 구독 당 500 푸시 알림의 속도로 조절됩니다 ( 일). 자세한 내용은 인증 된 웹 서비스를 설정하여 Windows Phone에 푸시 알림 보내기를 참조하십시오.

관련 링크 :

Sending push notifications for Windows Phone

Setting up an authenticated web service to send push notifications for Windows Phone

+0

는 지금은 이해합니다. 고맙습니다. Windows Phone에 대한 등록 프로세스가 전혀 없습니다. URI를 서버에 보내면됩니까? – steps

+0

@ JoãoPauloApolinárioPassos 인증 된 웹 서비스를 사용하여 푸시 알림을 보내려면 일부 등록 절차를 따라야합니다 (내 대답 하단의 링크 참조). 그렇지 않으면 단순히 통지 데이터를 URI에 POST 할 수 있습니다. – Eran

관련 문제