Friday, November 23, 2012

Sleep Stats

As a father of an infant born with severe acid reflux I am up many times throughout the night and I wanted to know how many actual hours of sleep I was yielding. Since I am a proud owner of a Windows Phone, I decided to build an app to do that.
It is called Sleep Stats and it can be found here

It's really easy to use - just press the Sleep button when you go to sleep and the Wake Up button when you wake up. Do that throughout the night and you'll get a total number of sleeping hours, number of interruptions, average quality of sleep, etc. You can than save all this data as a .csv file to your SkyDrive and open it in Excel for even more number crunching.

The second update of the app has a couple of bug fixes and support for Portuguese.

Check it out! Night-night...

Sunday, November 11, 2012

Wasted a couple of hours (hopefully you won't)

I hope that you reach this post if you 1) are using Isolated Storage Explorer in your project, and 2) your app runs fine on the emulator but crashes on the device. Ok, by now you're thinking "Aaaaaah! Of course!" and are no longer reading.
In case you are still here, yes, you're right, you forgot the Isolated Storage Explorer registration code in the Application_Launching and Application_Activated events.

You can leave the code there but make sure you run it only when in the emulator:

if (Environment.DeviceType == DeviceType.Emulator)

Monday, November 5, 2012

Mobile Client switch for Windows Phone apps

Many of the Windows Phone apps I use have some sort of integration with SkyDrive, sometimes as a store for backup data. You can find sample code on the web on how to do this, it's pretty simple. However, I had a bit of a problem trying to get connected and the app wouldn't even show the SkyDrive login page. 
After some digging around I found that, because my app was a Windows Phone app, it requires a newer set of OAuth mechanism, and in order to use it the app needs to be marked as Mobile Client App.

To find this option log onto, go to "My Apps" and select API Settings: