Today when you think about developing an application you have to consider not only the desktop, but also think about the mobile platforms that exist today in the market. That said, you need to take care of notifications, user experience, user behavior, etc. if you want to succeed. This is Mobile Engagement, a new service in Microsoft Azure, still in preview, that allows us to stop worrying about all these needs in a consistent and easy way.
Through this unique service we are able to analyze, segment the audience and notify users of different platforms.
The first thing to do is to request access to the preview through the preview features page.
Once approved, a new section will appear on the portal called Mobile Engagement where you can create your first application.
The data you’ll need are:
- Application Name: This is a friendly name for the service.
- Platform: Today the service is available for iOS, Android, Windows and Windows Phone. If your application is supported in several platforms, you must repeat this wizard for each of those.
- Application resource name: enables you to identify the application in the collection of applications.
- Location: for now it’s only available in North Europe and Central US in the preview phase.
- Collection: If you’ve already created one collection you can select it in the combo, otherwise must create a new one. The collection is related to the location of the service and allows us to associate different applications under the same name (this is important when your application will be available on multiple platforms).
- Collection name: When you’re creating a new collection you must choose the name, which also will form part of the service URL.
In this post I’ll test the service with a Windows Phone 8.1 (Silverlight) application, which is the type of project supported for Windows Phone (both 8.0 and 8.1) in Mobile Engagement for now. Create a project through New Project> Visual C #> Store Apps> Windows Phone Apps> Panorama App (Windows Phone Silverligh) to start.
Now you have to download the SDK for Windows Phone. If you have created an application for each platform you need to access the corresponding Windows Phone app and go to the Quick Start section, where you will find the link to download it. Today is unavailable Nuget package but it is possible to configure as follows:
- Download the SDK.
- Right select the proyect and click on Manage Nuget Packages…
- Click on Settings and add a new source.
- As source choose the lib folder in the SDK and click on the Update button.
- Once added, if you refresh the «Manage NuGet packages» window you’ll see the package that you need to install.
Now you’re ready to connect your application with your new Mobile Engamenet account. The only value needed is the connection string that you can find in the Connection Info section on the portal.
In the Resources folder of the project you will find an XML file called EngagementConfiguration.xml where you have to add the connection string you’ve just copied.
You must also make sure that you have the necessary Capabilities in the WMAppManifest.xml file.
The next step is to modify the class which inherits MainPage.xaml for engagement: EngagementPage.
and also the code behind class for that xaml file.
To initialize the service you simply invoke Engagement.Instance.Init() method in the Application_Launching method so that it starts when you start the application, and Application_Activated for future access when the application is already open.
If you run the application in the emulator or device you will not notice any change. However, the application is sending basic information of your application. To check this, you can access the Engage section from the Azure portal.
This button takes you to the Azure Mobile Engagement portal, which will list the applications that you created earlier from the Microsoft Azure portal.
If you access the first one, which corresponds to the application for Windows Phone, you’ll see a series of tabs with different tasks:
- Analytics: Shows graphs according to different sections of the left.
- Monitor: You can see real-time user interaction from the point of view of sessions, activities, jobs, events, errors and unhandled exceptions.
- Reach: is the section dedicated to the creation and display of advertisements and notifications.
- Segments: is used to create and manage segments. A segment is a set of users by some criteria.
Through this article you already have the basics to start working with Mobile Engagement. In future posts I will show you how to leverage each of the sections.