Adventures in SensorCore SDK land

The Lumia SensorCore SDK (http://developer.nokia.com/resources/library/Lumia/sensorcore-sdk.html) caught my attention since the 0.9 beta version and I always wanted to create an app with it.

It allows a developer to access “motion data” (when the user allows it), which is stored on the phone. This data includes number of steps (running, walking), current motion, recently visited places and much more, see the link above.

To me it seems that fitness trackers are “the next big thing” at least at the moment. 🙂

Btw. I am still waiting for the release of the Microsoft Band in Austria so I can check, what I can do with it, from a developers perspective, unfortunately according to latest reports it seems that it does not have a „real“ OS running on it, so 3rd party apps may not be an option. 🙁

There are already some apps available that use the SensorCore SDK (like the health app from Microsoft) but I wanted to create my own “universal app” with a nice live tile.

A universal app is the “new way” to create apps that use WinRT and can run on windows phone and on “windows desktop” (windows store apps) and allow a developer to do code sharing so he/she does not need to maintain 2 different apps. Users only need to buy the app one time to have it on the phone an on their pc/notebook/tablet. It’s the suggested way by MS to create new apps.

Beside from the learning effect for creating a universal app, how to do code sharing, using the latest version of MVVMLight, UI components that work on phone and windows…I also had many ideas that I wanted to put in my app and hope that some users like it and buy it. 🙂

It’s still a long way to the completed app so this posting is more aimed at developers to tell them about the problems I encountered and a solution.

What’s the first thing you do as a developer trying a new technology?
I usually try to get a code example as soon as possible, if there is one available. 🙂

So I downloaded the “Steps” project from: http://developer.nokia.com/resources/library/Lumia/sensorcore-sdk/samples.html#toc_Steps

My test-devices: A Lumia 630 and a Lumia 1520 with cyan update.
Both devices support the SensorCore SDK.

Hint: Unfortunately only the newer phones have the required hardware sensors to support the SensorCore SDK.

The Lumia SensorCore SDK is available for Lumia 630, Lumia 635, Lumia 730, Lumia 735, Lumia 830, Lumia 930, Lumia 1520 and Lumia Icon, running on Windows Phone 8.1 with Lumia Cyan or Denim firmware.

When starting the app in Visual Studio 2013 in the debugger, it failed.
It showed a message that the phone does not support SensorCore SDK.

But when installing the app from marketplace, it worked.

After some research and try+error, I posted to the windows phone developer forum: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/a6425c4d-2ceb-4fcb-a06c-e5fe6d93f7a4/sensorcore-sdk-steps-example-app-not-working?forum=wpdevelop

The required entries in the ‚Package.appxmanifestfile‘ were missing, you need to add them manually.

So I added these required settings of my windows phone project in Visual Studio at the end of the file.

This enabled the app to run but the live tile was not updating.

So I opened another thread: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/6ea4cbbc-8649-462e-9ea2-8cfbeac672e7/lumia-sensorcoresdk-in-combination-with-background-task-not-working?forum=wpdevelop

The solution can be found at the end of this thread. Visual Stuido 2014 Update 4 removes the ActivatableClass entries from generated appxmanifest.xml if there is any background task referenced in the project.

A major bug and if you write an app that uses the SensorCore SDK you will encounter it yourself. 🙂

Good thing: The posted solution to re-add the required entries in the assembly manifest file works. My „Daily Activities“ app currently shows the number of daily steps, distance and calories in the app itself and on the live tile.

DailyActivitiesLiveTile

Please not this is a very early screenshot of the apps live tile, created to test the live tile functionality, it will change before the final release and this will still take some time.

If you are interested in beta testing of my „Daily Activities“ app, you can send me an email and I will add you to the list of beta tester! 🙂

I also attached the apps current Package.appxmanifest file that contains all required entries for the SensorCore SDK to work in the app and also in background task agents. You can use it to copy them to your manifest file. Please do NOT replace your mainfest file with this file since your manifest file also contains your app name and publisher id.