HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to create walking step counter App using Accelerometer sensor and Shared Preference in Android?

21,076 views October 25, 2019 26:47

Watch on YouTube
ChannelProgrammer World

Description from the creator

How to use Accelerometer sensor and SharedPreference to retain the data in onResume, onPause and onStart method for applications like steps counter in custom Android App?


This video shows the steps to use the accelerometer sensor in your App. The use case taken in this video is about counting steps using the accelerometer sensor data. It retrieves the acceleration along x,y and z axis. To compute the step movement, the algorithm used in the App is very simple. It simply takes the magnitude of the acceleration along the 3 axis. Then it calculates the difference of the acceleration magnitude from the previous values. If this value is greater a certain threshold (For walking greater than 6 and for running greater than 10) then it does the counting accordingly. In this video the climbing of stairs is not considered as separate acceleration along the y-axis data is not considered to avoid unnecessary complicating the algorithm and making the video lengthy.

Towards the later part of the video it is shown in the App that how to use the SharedPreferences to store the data for subsequent running of the App. The data is saved in the Shared Preference of the App during onPause and onStop method. Using onResume method, the data is retrieved back for the subsequent use.

In the end it is shown that how can you quickly create a APK file for your App which can be used to install the App on your Phone.

We will be glad to hear from you regarding any query, suggestions or appreciations at: [email protected]

programmerworld.co/android/how-to-create-walkin…

About this tutorial

Programmer World published this 26:47 video tutorial on October 25, 2019. It has been watched 21,076 times on YouTube.

Category
Education
Duration
26:47
Published
October 25, 2019
Views
21,076
Likes
213

Share

Further reading

This tutorial in other languages