2014-12-30 4 views
1

Windows Phone 앱에서 구문 푸시 알림을 설정할 때 this tutorial을 따라 왔습니다. 이것은 내 코드입니다.Windows Phone 앱이 Parse.com에서 푸시 알림을 수신하지 않음

public App() { 
    // Global handler for uncaught exceptions. 
    UnhandledException += Application_UnhandledException; 

    // Standard XAML initialization 
    InitializeComponent(); 

    // Phone-specific initialization 
    InitializePhoneApplication(); 

    // Language display initialization 
    InitializeLanguage(); 

    // Show graphics profiling information while debugging. 
    if (Debugger.IsAttached) { 
    // Display the current frame rate counters. 
    Application.Current.Host.Settings.EnableFrameRateCounter = true; 

    // Show the areas of the app that are being redrawn in each frame. 
    //Application.Current.Host.Settings.EnableRedrawRegions = true; 

    // Enable non-production analysis visualization mode, 
    // which shows areas of a page that are handed off to GPU with a colored overlay. 
    //Application.Current.Host.Settings.EnableCacheVisualization = true; 

    // Prevent the screen from turning off while under the debugger by disabling 
    // the application's idle detection. 
    // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run 
    // and consume battery power when the user is not using the phone. 
    PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; 
    } 

    // Initialize the Parse client with your Application ID and .NET Key found on 
    // your Parse dashboard 

    ParseClient.Initialize("grpTmrClet8K35yeXg2HQKK8wl59VeC9ijH0I0dn", "os8EfSFq9maPBtDJ91Mq0xnWme8fLANhttTPAqKu"); 
    // After calling ParseClient.Initialize(): 
    this.Startup += async (sender, args) => 
    { 
     // This optional line tracks statistics around app opens, including push effectiveness: 
     ParseAnalytics.TrackAppOpens(RootFrame); 

     // By convention, the empty string is considered a "Broadcast" channel 
     // Note that we had to add "async" to the definition to use the await keyword 
     await ParsePush.SubscribeAsync("testchannel"); 
    }; 


} 

// Code to execute when the application is launching (eg, from Start) 
// This code will not execute when the application is reactivated 
private async void Application_Launching(object sender, LaunchingEventArgs e) { 
    await ParseAnalytics.TrackAppOpenedAsync(); 
} 

Parse 대시 보드에서 푸시 알림을 보내면 수신되지 않습니다. 전 에뮬레이터 (Windows Phone 8.0)와 장치 (8.1)에서 모두 실행 해 보았습니다. 포 그라운드에서 백그라운드로 실행되고 동일한 부정적인 결과로 종료되었습니다.

위의 "testchannel"과 같은 채널을 사용하고 세그먼트 옵션을 사용하면 채널 이름이 옵션의 드롭 다운 목록에 표시되어 앱이 최소한 구문 분석에 연결되었음을 나타내지 만 알림을받지 못한다는 것을 나타냅니다.

누군가가 제가 누락 된 부분을 식별하도록 도와 줄 수 있기를 바랍니다. 미리 감사드립니다.

답변

1

Windows Phone 8.1 앱을 개발하는 경우 매니페스트 파일에서 알림을 사용하도록 설정했는지 확인하십시오. 파스에 대한 모든 것을 아직 이해하지 못했지만 이것이 저에게 효과적입니다. App.xaml.cs를에서

:

public App() 
    { 
     this.InitializeComponent(); 
     this.Suspending += this.OnSuspending; 

     ParseClient.Initialize("wSjuNTbtjVLRaedXvOoaf9S5cTbkuQohTulNZ2vS", "nWZMhXRet9Wotlgikb9aUdKf5GFtRiMvduw7w68z"); 

    } 

우리는 구독 및 분석을 가능하게는 OnLaunched :

트릭을 할 단순히 것이다
protected async override void OnLaunched(LaunchActivatedEventArgs e) 
//Generated codes go here 
await ParsePush.SubscribeAsync("testchannel"); 
await ParseAnalytics.TrackAppOpenedAsync(); 

. 필요에 따라 코드를 수정해야합니다. 희망이 도움이됩니다.

+0

내가 그래서 대신 OnLaunched의 Application_Launching의 마지막 코드를 넣어 윈도우 폰 8 앱을하고있는 중이 야 : – Tugees

+0

개인 비동기 무효 Application_Launching (개체를 보낸 사람, LaunchingEventArgs 전자) { 는 ("testchannel") ParsePush.SubscribeAsync을 기다리고 있습니다; 기다리고 있습니다. ParseAnalytics.TrackAppOpenedAsync(); } – Tugees

+0

도움이 되시길 바랍니다. launch 이벤트 args를 전달할 수 있습니다. await ParseAnalytics.TrackAppOpenedAsync (e); –

관련 문제