Search code examples
c#azurewindows-phone-8backgroundwindows-phone-8.1

Background raw push notifications is received from server in Window Phone 8.1


I want to execute my own function when a push notification (raw message from azure) is received even when the app is not running. And the user doesn't need to click the notification in action bar.

i tried this way "Execute some function after raw push notifications is received from server in Window Phone 8.1"

but i am not getting background event, even azure send raw message successfully, but toast message is working

i registered my appname at MS development dashboard , and i tried windows phone silverlight 8.1 and runtime too...

Please help me thank you in advance.....


Solution

  • After long research , I can able to get raw notification from background, this time i am used MS push sample server (http://pushtestserver.azurewebsites.net/wns/) which needs URI,Package Security Identifier (SID) and Client Secret.

    (universal app)

    1. URI you can get form app

    var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

    string uri = channel.Uri;

    1. Package Security Identifier (SID) and Client Secret can get from developer dashboard (you should have developer account to get dashboard)

    2. Right click on your WPproject 'store->Associate App with the Store...' follow instructions... (https://azure.microsoft.com/en-in/documentation/articles/notification-hubs-windows-store-dotnet-get-started-wns-push-notification/) check for 'Register your app for the Windows Store'

    3. Set Tost capable 'yes' and Lock screen notification is 'badge or badge/Tiletest' in Package.appxmanifest

    (Windows phone 8.1 Silver light)

    1 and 2 same as universal app

    1. 'store->Associate App with the Store...' not available for silverlight project to associate app fill your package details with your dashboard registered app details (try to upload you xap file in to store will give you where you are not matched with account)

    4 same as universal app

    Hint: Raw notification sample form Microsoft is not fully implemented for windows phone, to work for windows phone please create background project and add reference to your windows phone project.