Windows Phone 8.1 Push Client SDK
You can find the Windows Phone Sample App on github
The Pivotal Cloud Foundry Mobile Services Push Client SDK is a light-weight library that will help your application register with Windows Notification Service (WNS) and an instance of the PCF Mobile Services Push Notification server.
The SDK does not provide any code for handling remote push notification.
The Push SDK requires WP8.1.
In order to receive push messages from the Push Server in your WP8.1 application, you will need to follow these steps:
- You must have a Windows Store account, and your app must be registered with the windows store, and must you have a certificate for receiving pushes. Follow the instructions here:
Finally, you need to associate your app with the windows store. Right click on your project in Visual Studio. Select Store. Select ‘Associate App with the Store…’ Follow Microsoft’s on-screen instructions to complete app-to-store association.
Set up your application, environment, and a variant on the PCF Mobile Services administration console. This task is beyond the scope of this document, but please note you will need the TLS certificate above. After setting up your variant in PCF Mobile Services, make sure to note the Variant UUID and Variant Secret parameters. You will need them below.
Add a reference to the SDK NuGet package to your project. If you don’t have access to the NuGet, you could simply obtain the compiled DLL files. Please contact the PCF Mobile Services team for help.
Add the following lines of code to the initialization section of your application.
MSSParameters parameters = new MSSParameters(variant_uuid, variant_secret, base_server_url, server_name, device_alias, tags); await MSSPush.SharedInstance.RegisterForPushAsync(parameters);
server_name are described above. The
base_server_url parameter is the base url of your push server. The
device_alias parameter is a custom field that you can use to differentiate this device from others in your own push messaging campaigns; can be null. The
tags parameter is a custom field that you can use to differentiate registrations in your own push messaging campaigns; can be null.
You should only have to call
RegisterForPushAsync once in the lifetime of your process - but calling it more times is not harmful. The
RegisterForPushAsync method is asynchronous and will return before registration is complete. To know when registration is complete (or if it fails) and obtain the
PushNotificationChannel, provide an
Action<PushNotificationChannel> as the second argument.
The PCF Mobile Services Push SDK takes care of the following tasks for you:
- Registering with WNS.
- Sending your push notification channel URI to the back-end (i.e.: the PCF Mobile Services).
- Re-registering after the push notification channel URI or any other registration parameters are updated.