Push Notifications in Native Windows Phone 8 Applications
improve this page | report issueOverview
This tutorial explains how to configure a MobileFirst Native Windows Phone 8 application to support push notifications.
Also mentioned are the addresses and ports that are required for notifications to arrive to the supported Microsoft Push Notification Service vendor (MPNS).
Prerequisite: Make sure that you read the Configuring a native Windows Phone 8 application with the MobileFirst Platform SDK tutorial first.
Setting up the project
To send push notifications to Windows Phone 8 devices, use the Microsoft Push Notifications Service (MPNS).
- Non-authenticated push notification does not require any setup from the developer. Authenticated push notification requires a Windows Phone Dev Center account.
- To use authenticated push, you must use a certificate that is issued by a Microsoft-trusted root certificate authority. For production, consider using authenticated push notification in order to ensure that the information is not compromised.
-
Create a MobileFirst project.
Add a MobileFirst Windows Phone 8 native API. The native API project provides the files that are necessary to build a Windows Phone 8 app.
-
Edit the
application-descriptor.xml
file.Add the pushSender element under the nativeWindows8App environment (these settings are also editable with the Application Descriptor Editor in Design mode).
- Non-authenticated push
<nativeWindowsPhone8App id="AppName" platformVersion="7.0.0.00.20150312-0731" version="1.0" xmlns="http://www.worklight.com/native-windowsphone8-descriptor"> <displayName>AppName</displayName> <description>AppName</description> <pushSender /> </nativeWindowsPhone8App>
- Authenticated push
<nativeWindowsPhone8App id="AppName" platformVersion="7.0.0.00.20150312-0731" version="1.0" xmlns="http://www.worklight.com/native-windowsphone8-descriptor"> <displayName>AppName</displayName> <description>AppName</description> <pushSender> <authenticatedPush serviceName="" keyAlias="" keyAliasPassword=""/> </pushSender> </nativeWindowsPhone8App>
- Replace serviceName value with the service name.
- Replace keyAlias value with the certificate alias.
- Replace keyAliasPassword value with the certificate password.
- Non-authenticated push
-
Edit the
wlclient.properties
file.Edit the
wlclient.properties
file in your native Windows Phone 8 project and enter appropriate values for the following fields:wlServerHost
- The host name or IP address of the MobileFirst Server instance.wlServerPort
- The port on which MobileFirst Server is listening.wlServerContext
- The context root of your MobileFirst Server instance.- wlMPNSServiceName = Add the MPNS service name for authenticated push.
wlServerProtocol = http wlServerHost = wlServerPort = 10080 wlServerContext = /EventSourceNotifications/ wlAppId = NativeWP8EventSource wlAppVersion = 1.0 wlEnvironment = WindowsPhone8native wlPlatformVersion = 7.0.0.0 #languagePreferences = Add locales in order of preference (e.g. fr, en, pt-BR) wlMPNSServiceName = Add the MPNS service name for authenticated push.
-
Modify the native Windows Phone 8 project.
Edit the
Properties\WMAppManifest.xml
file and add the following capabilities:
<Capability Name="ID_CAP_PUSH_NOTIFICATION" /> <Capability Name="ID_CAP_IDENTITY_DEVICE" />
For more information about using the certificate file, see the topic about setting up push notifications for Windows Phone 8, in the user documentation.
Windows Phone 8 Push Notifications Service
No specific port needs to be open in your server configuration.
MPNS uses regular http or https requests.
Notification Types
▲- Event Source Notifications in Native Windows Phone 8 Applications
- Tag and Broadcast Notifications in Native Windows Phone 8 Applications
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.