-
-
Notifications
You must be signed in to change notification settings - Fork 268
Usage
Nishant Srivastava edited this page Jun 14, 2016
·
15 revisions
- Initialize Sensey under your onCreate() in the activity/service
Sensey.getInstance().init(context);
-
Next to enable detection for
-
Shake
Sensey.getInstance().startShakeDetection(new ShakeDetector.ShakeListener() { @Override public void onShakeDetected() { // Shake detected, do something } });
If you want to modify the
threshold
, pass anint
as valueSensey.getInstance().startShakeDetection(threshold, new ShakeDetector.ShakeListener() { @Override public void onShakeDetected() { // Shake detected, do something } });
-
Flip
Sensey.getInstance().startFlipDetection(new FlipDetector.FlipListener() { @Override public void onFaceUp() { // Face up detected, do something } @Override public void onFaceDown() { // Face down detected, do something } });
-
Orientation
Sensey.getInstance().startOrientationDetection(new OrientationDetector.OrientationListener() { @Override public void onTopSideUp() { // Top side up detected, do something } @Override public void onBottomSideUp() { // Bottom side up detected, do something } @Override public void onRightSideUp() { // Right side up detected, do something } @Override public void onLeftSideUp() { // Left side up detected, do something } });
-
Proximity
Sensey.getInstance().startProximityDetection(new ProximityDetector.ProximityListener() { @Override public void onNear() { // Near, do something } @Override public void onFar() { // far, do something } });
-
Light
Sensey.getInstance().startLightetection(new LightDetector.LightListener() { @Override public void onDark() { // Dark } @Override public void onLight() { // Light } });
If you want to modify the
threshold
, pass anint
as valueSensey.getInstance().startLightetection(threshold,new LightDetector.LightListener() { @Override public void onDark() { // Dark } @Override public void onLight() { // Light } });
-
-
To disable detection for
- Shake
Sensey.getInstance().stopShakeDetection();
- Flip
Sensey.getInstance().stopFlipDetection();
- Orientation
Sensey.getInstance().stopOrientationDetection();
- Proximity
Sensey.getInstance().stopProximityDetection();
- Light
Sensey.getInstance().stopLightDetection();