Motion Detection is an Android
application to detect the motion of a device using sensor. The project
aims at generating an android app to find out the direction of motion of
android device when it is shaken. Motion detection facility of android
device is utilized in playing games, finding relative motion of device
as well as determining the change in position of device.
Below, I have briefly introduced the
features, scopes and testing procedure of project. You can access the
source code of this application project from the download links provided
in this post. Motion Detection Android app’s source codes include code of Android XML file and code of Android Java file.
About Motion Detection Android App:

With growing competition among the
mobile companies, cellphones with new and genuine features are being
launched each day. Every company is trying to introduce some unique
features in their product. And, one of them is motion detection feature.
It is not a newly launched facility but has good scopes in Android and
similar phones.
Nowadays, motion detection games, being
more realistic and entertaining, are getting popular. Moreover,
different kind of motion sensor such as acoustic sensor, optical and
infrared sensor, magnetic sensor etc. are used in scientific labs, banks etc. for security purpose.
This Motion Detection app for
android is a stimulator to detect change in position of device in
surrounding relative to the device. There may be both mechanical and
electronic method to detect motion of an object. The coding of this app
is simple and provides minimum features.
Many kinds of motion detection methods
are available for android devices. Out of these, accelerometer sensor is
the most widely used motion detector in mobile devices, and especially
Android phones. So, this project is built on the basis of the same
sensor to detect motion.
Features:
Listed below are some of the key features of Motion Detection application:
- The app detects the motion of device using accelerometer sensor.
- It assists in introducing features such as auto rotation of screen in android devices.
- It can be used to play games that support motion detection.
- The generated application of project is only for android operating system devices.
- The application is easy to download, install and run.
How to Test Motion Detection Android App?
- Download the code of android XML and code of android JAVA file from the link given in the post.
- Create a new android project.
- In order to display a random number on every shake of mobile in any one direction, drop one text view and give id textView1.
- Now, open JAVA file. Get the sensor services with the help of sensor manager.
- After registering the sensor object to Accelerometer sensor, give delay depending upon your application — use game delay in game app.
- Run the project, install .APK file on your mobile, and test the project.
Conclusion:
As there is no sensor in emulator, and
also due to the fact that you can’t shake your emulator, you can’t test
this project on emulator. The source code of Motion Detection
app contains various comments within the source code; so, you won’t find
any difficulty in understanding this project. Also, carefully follow
the steps aforementioned to install and test the app.