ShakePhoneLib
jcmore2
42
Visit GitHub RepoSensors

ShakeIt

This library runs background service that is listening for shake movements in device.

Usage

Add library to your build.gradle:

	    compile 'com.jcmore2.shakeit:shakeit:1.0.0'

Declare ShakeIt service in your AndroidManifest:

<service
		android:name="com.jcmore2.shakeit.ShakeService"
		android:exported="false"
		android:label="@string/app_name"/>

To use ShakePhone library you can initialize ShakeIt using a Context instance and one ShakeListener:

		ShakeIt.initializeShakeService(this, new ShakeListener() {

			@Override
			public void onShake(float force) {
					shakeButtons();

			}

			@Override
			public void onAccelerationChanged(float x, float y, float z) {

			}
		});

Or customizing threshold and interval:

		ShakeIt.initializeShakeService(this, 20, 600, new ShakeListener() {

			@Override
			public void onShake(float force) {
					shakeButtons();

			}

			@Override
			public void onAccelerationChanged(float x, float y, float z) {

			}
		});

You can stop the ShakeIt service like in this sample:

	ShakeIt.stopShakeService(context);

and Just Shake your phone!!

Credits & Contact

ShakePhone was created by jcmore2@gmail.com

License

ShakePhone is available under the Apache License, Version 2.0.

Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT