Many mobile-programming APIs (such as iOS? and Android?) can trigger code execution when a user activity is detected. The detected activity can include, but is not limited to: walking, running, cycling, driving, sitting, being stationary, or an unknown activity. The data collection can be triggered in the background, when any change of activity is detected other than being stationary.
For example, FIG. 8A illustrates an exemplary system that triggers collection of sensor data based on activity detection in accordance with the disclosed embodiments. The system in FIG. 8A includes a mobile device 808, which can include: a smartphone, an IoT device, or any other device capable of collecting sensor data.
As illustrated in FIG. 8A, mobile device 808 includes an activity detection module 809, a data collection module 810 and a data buffer 811. Activity detection module 809 can be implemented using an activity-detection application programming interface (API), as is provided by iOS? or Android? and possibly from other libraries for developing mobile devices, wearable devices, smart devices, or any other Internet-connected devices that can collect sensor data. For example, the CoreActivity? API for iOS? and the ActivityManager? API for Android? can be used to trigger code execution when there is an activity change.