Best practices

When you are designing applications that utilize the Lumia SensorCore SDK, please consider the following guidelines and comments.

Quick checklist

  • Verify that the device supports the SensorCore SDK, and in case it doesn't, hide the SensorCore dependent functionality unless it is essential for the application.
  • Check if the user has Motion data and location services enabled. If not, provide an easy way of enabling them. Fail gracefully if the user chooses not to.
  • Handle the situation where the user configures Motion data or disables location services while the application is still running.
  • Activate and deactivate SensorCore when the user navigates to/away from the app.
  • Be prepared for the scenario where SensorCore hasn't yet accumulated data to the device.
  • Be sensitive with the user's location and Motion data, and obtain the user's express permission before uploading or sharing the information out from the device.

Provide users with an easy way of enabling location services or Motion data. Many people may have either location services or Motion data disabled by default. Apps should provide users with an easy way to enable the necessary features for a better user experience.

Motion data is not available on all devices. Apps utilizing SensorCore SDK can also be installed on devices that do not support SensorCore SDK functionalities. Apps should prepare for a case when no sensor or sensor data is available. If an app has no functionality without SensorCore SDK, it should be stated in the app's Marketplace description.

If Motion data is set to Basic mode, remember the passive nature of Place Monitor and Track Point Monitor. Place Monitor and Track Point Monitor will not actively poll user's location. Therefore, it might take several hours until the data gets updated. The frequency of history data is dependent on whether some other applications are currently using GPS or not. The user's environment will have an effect on data accuracy and update frequency. For example, in city areas, the data is more accurate and the frequency of updates is higher than in the countryside. In normal city conditions, you can expect to receive updates around every 500 meters for Track Point Monitor. With the Place Monitor, consider combining the data with more active positioning methods to create compelling apps.

Note the latency introduced by filtering. In order to improve Step Counter and activity detection accuracy, the sensor data is filtered before it is made available through the API. This adds some latency to the step and activity detection. For example, Step Counter readings will be approximately 6-7 seconds "late". Therefore, it is advisable to decrease the granularity of the data shown in the UI, for example, by rounding step count to the nearest 50 or 100 steps.

Note the granularity of Step counter history data. Step Counter history data is collected by the sensor every five minutes. Data collection is aligned with the system clock, i.e. always at the hour, five minutes past, ten minutes past, etc. This means that if you combine the data with Activity Monitor history data, you will be unable to get accurate measurement at the exact moments of activity changes. Note that the current reading polled from the Step Counter will always be up-to-date, not (up to) five minutes off.

Note that the Step Counter data is absolute. Step counts and walking/running times returned by the Step Counter are total numbers since the last device factory reset or motion data clearing from motion data settings. If you need step counts and walking/running times since your application was first started, you will have to save the step count value you get the first time the application is started up. Save that value in your application persistent data storage. On subsequent application start, poll the current value of the step count, and subtract the saved value to calculate the delta. In such a case, it is important to remember that the step count can be cleared by the user.

Try to reduce the usage of background processes. If possible, utilize history data that is collected by the sensors instead of polling or monitoring the sensors in background processes. The sensors collect data in a very power-efficient way, so make use of that whenever possible.

The data is saved for 10 days. If it can be assumed that your
application will be used at least once every 10th day, you could just collect the history data since the last time your application was used and not have to use background processes at all.

Be aware of system clock change behavior. Changing the system clock manually, for example, due to daylight savings or travelling to another time zone, will have an effect on collected motion data. In case the clock is moved backwards, any data left in the future will get deleted. In case the clock is moved forward, there will be gaps in the history data. Changing the date, even momentarily, for more than ten days will result in all the history data getting cleared.

Privacy is critical part of the system. The system requires the user to enable Location and Motion data for the SensorCore to work. In case your application moves any location or Motion data outside of the device to the backend, it is strongly recommended for the app to ask for permission from the user for this action. For more details, check the Privacy section.

Remove the testing package from the final product. Although the Lumia SensorCore Testing package is a great tool to use for testing and debugging, it increases the size of your final product considerably, so we recommend that you ensure that you have removed the testing package before submitting your package to the store.

Features affecting the data quality

When the Lumia SensorCore SDK collects the sensor data, it is depending on various things on the actual device to be available and turned on, such as location and motion data. Besides these features, there are certain things that will impact the quality of data depending on their availability; we illustrate those things in the following diagram.

Accelerometer

Cellular Network

GPS

Wi-Fi

Step Counter

X

(*)

Activity Monitor

X

(*)

Place Monitor

X*

X

X*

Track Point Monitor

X*

X

X*

  • * Will also improve the GPS performance if present
  • (*) If motion data is set to Detailed mode

Note:

  • An accelerometer is crucial for the functionality of Step Counter and Activity Monitor.
  • It is good to notice that Accuracy of Track Point Monitor is area dependent if motion data is set to Basic. The accuracy is optimal in densely populated regions with plenty of cell towers and Wi-Fi base stations.
Show: