Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Lumia SensorCore FAQ

From Wiki
Jump to: navigation, search
Featured Article
23 Mar

Frequently asked questions about the Lumia SensorCore SDK beta.

Article Metadata
Created: (24 Jun 2014)
Last edited: juhanak (16 Jul 2014)

Q: I cannot find an answer to my question on this page. What should I do next?
A: First, check the developer documentation and find out if your question is answered there. If not, visit the Discussion boards for further assistance.

Q: Are there any sample recorded data sets available for testing?
A: Lumia-Sensorcore-Simulation GitHub project contains simulation files.

Using simulated data is easy. For example you can use TrackPointMonitor data in following way:

var obj = await SenseRecording.LoadFromFileAsync("90 minutes cycling.txt");
tracker = await TrackPointMonitorSimulator.GetDefaultAsync(obj, DateTime.Now - TimeSpan.FromMinutes(90));

The second parameter tells the simulator that the simulation started 90 minutes in the past. In this particular case it means we will have all track points available in the tracker object already because the length of the simulation file is 90 minutes.

The simulator classes have also default data that you can use. For instance, just initialize PlaceMonitorSimulator.GetDefaultAsync() and you will have some default places available around Helsinki region.

Q: How can I simulate the ActivityMonitor?

var obj = await SenseRecording.LoadFromFileAsync("activities_10min_stationary_other_walking.txt");
activities = await ActivityMonitorSimulator.GetDefaultAsync(obj);

Q: What's the intended use of the ActivityMonitor and watchers? Can I listen to notifications in a background agent?
A: You should call DeactivateAsync when the app is put on background and ActivateAsync when the app is put back on foreground, even if you just access to the history data. ActivateAsync establishes the communication channel to the SensorCore service and this channel needs to be active when you access the history info.

Currently you can only receive notifications while the application is running. Also, an activity monitor object needs to be initialized before you can subscribe to activities. There are no SensorCore triggers that would launch a background task.

Q: Can I add another activity to the activity enum? If not, how would I detect another activity? ?
A: Currently only option for recognizing other type of activities is to read raw data from the accelerometer or other sensors and analyse it.

Q: How do you internally differentiate activities? For example, what are the metrics for an activity to be considered "running"?
A: Data from the different sensors is processed to extract the different properties of the device motion, such as zero crossings, mean values and other mathematical values that indicate how device is really moving. The qualities of these features differentiate, for example, between running and walking.

Q: What happens when the user clears the motion data? I understand that the aggregated step number will be reset to zero, right? In that case do we have the ability to know when the motion data has been cleared or not? ?
A: Yes all history data will be gone and all counters reset to zero. So just after the reset, GetCurrentReadingAsync() will return zero steps data and GetStepCountHistoryAsync() will return zero items. There are not any ready made functions available that would tell you if the user has reset the data. However it should be relatively straightforward to find that out by comparing the data that you get from GetStepCountHistoryAsync() to the data you have stored. For instance, if the last time the app was launched you calculated that a user had walked 1000 steps yesterday, and now the history doesn't have any information about yesterday's steps, that means the sensor data has been reset.

Note that the history can contain gaps if, for example, the device runs out of battery, it's been turned off, or the user has disabled the motion data collection for some interval. When making queries to history you should not expect that data is always available in five-minute intervals, as some intervals can be missing.

Q: Is it possible to add SensorCore to existing Windows Phone Silverlight 8.0 applications?
A: The SensorCore SDK does not support Silverlight 8.0. You will need to upgrade the application from Silverlight 8.0 to 8.1

Q: What device configuration should I use when I deploy my app?
A: Please use the ARM configuration when you deploy to a device, and x86 when using the emulator. Also, delete the "Any CPU" configuration that Visual Studio adds automatically. The code is processor/architecture-specific, so it might deploy but will fail on launch.

Q: Can you explain how the radius values are calculated?
A: A place's position and radius values are based on location data that is passively gathered from different sources: Cell IDs, GPS, and WiFi. Radius basically represents the uncertainty level about the Place's location. It is dependent on the available technology that is used to capture the current Place. After a visit to a place, sensor data for this place is updated with information from the last visit and the place type is calculated again. Radius, position, and type of Place are updated as more information about the place is available. The position and radius are not an arithmetic average but a recalculated position and radius incorporating all positioning data available at a given time for a particular place, and are updated as more information about the place is available. In short a large radius in an open field place generally indicates that during the visit to the place only low accuracy (maybe cell ID-based) location methods were used to determine the place location.

See also

This page was last modified on 16 July 2014, at 14:08.
94 page views in the last 30 days.