What there is and what there might be

As there is no one good public source for Windows Phone chassis specs, I decided to put together a small table which will list the things all Windows Phones have common and what are the optional things devs need to test for the existence.

WP8 chassis

Display part is quite self explanatory, interesting thing is that the specs go up to 7″ screens, which works out for phablets quite nicely. Screen resolutions are also something that devs need to realize, but fortunately the platform is quite nice about them and you don’t have to design for three different resolutions but it scales them automatically. The sensor part is a bit more complicated, and I’ll give a quick overview of them.

First of all, there are some sensors which are found in each WP no matter who’s the manufacturer, let’s call them base sensors. The base sensors are in the minimum hardware specifications, and can be found even in the low end models.

Base sensors

Assisted Global Navigation Satellite System receiver (A-GNNS) is for quick satellite fix, and helps you to get a faster location data for poor GPS signal or when the signal is not available.This sensor you don’t access yourself from the code but the system will take care of it when you deal with the GPS.

Ambient Light sensor can sense light from range of 0 lux up to 4000 lux or more. For this sensor, you have no access from your code either, so you can’t sense the lighting conditions but this information is delivered to OS itself only.

Proximity sensor will detect if the phone is in your pocket or on your ear, and will turn off the display to save battery. Again this sensor is not accessible from the code. Malfunction of this sensor will lead to situation where you can’t end the phone call as screen stays black. In these cases, it is advised to take the phone to repair center, and ask them to put some silicon around the sensor, that helped me (had this issue with three different WPs).

Vibration is the first sensor of these which you can actually access from your code, using Microsoft.Devices.VibrateController – .NET class or Windows.Phone.Devices.Notification.VibrationDevice – Windows Phone Runtime API. In hardware, vibration is done either by motor, speaker or haptics transducer.

Next up is the Accelerometer, which is three-axis with HW sampling rate up to 100 Hz. The accelerometer detects changes in the physical acceleration of your phone and fires events as X,Y,Z orientations change. This sensor can be accessed with WPRT in Windows.Devices.Sensors.Accelerometer and it delivers from SensorBase<T> class.

Optional sensors

There are a few sensors in WP which may or may not be there, depending on the make and model of your phone. When using these sensors, be sure to check at the beginning that they do exists in your code, before using them.

First and maybe even the most interesting of these all is the NFC, near field communication. I’ll write a separate post about doing NFC with WP, but what is important here is to remember to check if your client is enabled with NFC with the following code snippet:

ProximityDevice device = ProximityDevice.GetDefault()
if (device != null)
  // do your stuff

Magnetometer, also known as Compass is three-axis with sampling rate of 60 Hz. You can access it from Windows.Devices.Sensors.Compass class, and it also delivers from SensorBase<T> class. Interesting side-note is that if your app has ID_CAP_LOCATION, this will give your app more accurate computation of the declination which is different in different point on the earth and changes with time.

Lastly there is the Gyroscope, which is three-axis with sampling rate from 5 Hz to 250 Hz or more. If your device has a gyroscope, it must also have a magnetometer. You can access it through Windows.Devices.Sensors.Gyrometer and it also delivers from SensorBase<T> class.

That wraps it up for now, and in the next post I’ll talk more about using the NFC sensor.

About Jani Nevalainen

Windows developer who's been working on Microsoft Platforms since 1996. Windows Phone dev MVP 2013, Windows Development Platform MVP 2014. Currently working as Technical Evangelist for Microsoft Finland Developer Experience team.
This entry was posted in Windows Phone, Windows Phone 8 and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *