Azure Mobile Engagement - Windows Phone 8.1 Silverlight

We are here to discuss something that is really amazing interesting addition to Azure i.e. Azure Mobile Engagement. Azure Mobile Engagement is a SaaS-delivered, data-driven user engagement platform that enables real-time fine-grain user segmentation, app user analytics, and contextually-aware smart push notifications and in-app messaging across all connected devices.

With Azure Mobile Engagement, Application publishers and marketing professionals can create cutting edge interactions like the following,

  • Real Time actionable analytics to increase app usage
  • Push Notification and Communication Platform
  • Open API's and Ease of integration
  • Data Protection & Privacy across globe

Azure Mobile Engagement is available across all major mobile platforms including Android, iOS and Windows.

In this article we would start with Windows Phone 8.1 Silverlight Example,

First of all you need to create Mobile Engagement Application on Microsoft Azure and after you have created that we need to integrate that with our Windows Phone 8.1 Silverlight Client. Here's how you do that,

Mobile Engagement Application

After you have done that, you need to create a new Visual Studio Project for Windows Phone application. Remember that must be Silverlight Application. Once you have created the project you need to add Nuget Package for Mobile Engagement Application into your Windows Phone application. Once you have done that, you are ready to go.

home page

Next thing is configuring your application with Engagement Service. To do that, you need to move to solution explorer and under "Resources" you would have a file named as "EngagementConfiguration.xml" You must enter credential you got from your Azure portal. It assures you that you would be connected with exactly the same service you have created.

App.Xaml.cs


In App.xaml.cs you need to use Azure mobile engagement nuget package

Code:

  1. using Microsoft.Azure.Engagement;  
As we also need to add following lines in our Application life cycle methods,

Code:

private void Application_Launching(object sender, LaunchingEventArgs e) { EngagementAgent.Instance.Init(); EngagementReach.Instance.Init(); } // Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { EngagementAgent.Instance.OnActivated(e); EngagementReach.Instance.OnActivated(e); }

MainPage.xaml.cs

In backend class of MainPage you need add following code so that activity automatically starts when the page loads,

Code:
  1. using Microsoft.Azure.Engagement; public partial class MainPage : EngagementPage  
MainPage.xaml

In frontend file of your mobile silverlight application you need to change the main tag of page to <engagement:EngagementPage>.

After that you need to add reference of your library in XMAL page,

Code:
  1. xmlns:engagement="clr-namespace:Microsoft.Azure.Engagement;assembly=Microsoft.Azure.Engagement.EngagementAgent.WP" mc:Ignorable="d"  
Capabilities:

How can you forget about adding capabilities, you need to add appropriate capabilities that you application uses , e.g. Identity_device , WebrowserComponent , PushNotification.

Capabilities

Testing Application Engagement

After you have done that, you just need to open Application Engagement portal provided by Azure. When you run your application you would notice changes in analytics.

You can also add push notifications after going to reach tab and by creating a new announcement. You can choose to which audience you need to notify. It can be current users and can be all users.

Testing Application Engagement

Conclusion

This was brief introduction of Azure Mobile Engagement, you can use this feature for marketing monitization, and for other different purpose. Stay in touch for tutorials on other mobile platforms as well. To learn more about Azure Mobile Engagement, browse.


Similar Articles