Windows phone 8.0 versus 8.1
Today, I thought I would talk about an issue that plagued me for hours. Maybe it will save someone else from this headache. There seems to be a change in the Namespaces that are available for accessing devices is the Phone SDK from 8.0 to 8.1 as far as WinRT development. It seems that the 8.1 SDK only has System.Devices.Sensors is really only available for Silverlight and not for normal 8.1 development. Here is an SO question that relates to similar issues and what they did about it. Basically, they reinstalled the 8.0 SDK and used that instead, but to me, that isn’t acceptable at this point because I’m sure that at some point 8.0 won’t be accepted. To me 8.0 is kind of like Vista or Millennium in the OS world. Eventually those abominations were ignored as if they never existed. So if you want your application to be compatible moving forward, I would not recommend that solution.
This is not widely documented and is actually shown within the MSDN documentation as being available for both. I have reached out to several evangelists that say they will look into why this is, but I have not heard back from them as of yet. It has been several months since I heard back from them that they were looking into it, so I am not too hopeful for an answer.
Accessing Shake in the Accelerometer Oddities
This is another thing wrong with the namespace. The Shake event seems to be missing for the phone SDK without Silverlight. Here is an SO question I asked related again to the Microsoft.Devices.Sensors namespace. What is interesting (and extremely frustrating) is that apparently you can access the namespace, but half of the methods and properties that are in the tutorials available on MSDN and the like are only accessible when creating a Silverlight project and NOT regular phone WinRT applications. In further digging, it is documented in the deep boules of the MSDN documentation, but you really have to dig to find it. The documented blurb is in that same SO question.
This blog was mostly informational to hopefully alleviate headaches for other developers since it took a lot of digging for me to get a solid answer. Hopefully this will be addressed in future SDK updates because it really is frustrating. For now, if you need to do anything with the accelerometer or the Sensors namespace, it is probably best to create a Silverlight application to save yourself time and exhaustion!