Getting Started with Mood Tracker #2

In the last post, we sort of defined what our emotion tracking application should do. Lets get started with building it. I assume you have visual studio installed with WP7 tools, if not you can get them from here.

image

Fig 1. Windows Phone 7 SDK

Next, we go over to codeplex, and download the HealthVault library with the sample.

image

Fig 2. HealthVault WP7 library.

I extracted the library to my desktop and the folder structure looks like following -

image

Fig 3. HealthVault WP7 library extracted.

I open the MobileSDK solution in visual studio and hit F5, the library compiles and the WeightTracker demo starts -

image

Fig 4. Compiling and running HealthVault WP7 Sample Application

Without further ado lets create our new Silverlight for Windows phone project in our solution for MoodTracker, and reference the HVMobilePhone library in that project.

image

Fig 5. Beginnings of MoodTracker

First things first, lets get the application setup to talk to HealthVault, in App.xaml.cs class we add reference to HealthVaultService & HealthVault Shell, we also need to make sure we get a unique application ID in the developer environment of HealthVault, to do that we head over to HealthVault Application Configuration Center, and create a new application by clicking on the button –

image

Fig 6. Creating a new application in Application Configuration Center

We create an application of type SODA and pick the name Mood Tracker for it –

image

Fig 7. Creating Mood tracker as a SODA application

One the application is created we click on the app link and assign appropriate data-type for this application using the SODA-

image

Fig 8. Adding Emotional State to our Mood tracker application.

One we create the SODA application, and appropriate data type rules we are all set! Now we can configure our base page to work with HealthVault Pre-production environment. Here is my initial code for it –

    public partial class App : Application
    {
        public static HealthVaultService HealthVaultService { get; set; }
        public static string HealthVaultShellUrl { get; set; }

        static string platformUrl = @"https://platform.healthvault-ppe.com/platform/wildcat.ashx";
        static string shellUrl = @"https://account.healthvault-ppe.com";
        static string masterAppId = "83bf507d-9186-407f-a6cd-b2d65f558690";

        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            HealthVaultService = new HealthVaultService(platformUrl, shellUrl, new Guid(masterAppId));
        }
        // 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)
        {
            HealthVaultService = new HealthVaultService(platformUrl, shellUrl, new Guid(masterAppId));
        }

..

We make this project as startup project and hit F5, and get to the first page of our application!

image

Fig 9. A start with HealthVault Service configure in base page

We have lots more to do!

Next time, we will focus on authenticating this application with HealthVault Shell!

3 comments ↓

#1 Sammoh on 07.12.11 at 8:49 am

Vaibhav,
Is there any client library for Android platform?
TIA

/Sammoh

#2 vaibhavb on 08.05.11 at 9:44 am

hi Sammoh –

Yes there is, you can find it at http://healthvaultjavalib.codeplex.com/.

regards,
vaibhav

#3 Associating Mood Tracker With HealthVault #3 — Reviving The Health Revolution on 09.30.12 at 5:14 pm

[...] ← Getting Started with Mood Tracker #2 [...]

Leave a Comment