System.Devices not ‘really’ accessible in Windows phone 8.1

 

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!

 

Happy CodingSmile

Advertisements

About Gregg Coleman

I am Senior-level Software Engineer working primarily these days with .NET. I have a good working knowledge of ASP.NET MVC, Web Forms, WCF web services and Windows Services. I spend much of my time in the Web Services (SOAP and REST) world in my current job designing and implementing various SOA architectures. I have been in the software engineering industry for about 6 years now and will not now nor ever consider myself an "expert" in programming because there is always so much to learn. My favorite thing about designing software is there are always new emerging technologies and something to learn every day! My current job has me spending much of my job on the bleeding edge of technologies and changing gears all the time, so I'm never bored and always challenged. On my spare time I enjoy weight training, reading and venturing to new places near by. Of course programing and learning new technologies are another hobby of mine.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s