Code Monkey home page Code Monkey logo

seismic's Introduction

Seismic

Android device shake detection.

Download

Download the latest .jar or depend via Maven:

<dependency>
  <groupId>com.squareup</groupId>
  <artifactId>seismic</artifactId>
  <version>1.0.3</version>
</dependency>

or Gradle:

implementation 'com.squareup:seismic:1.0.3'

Snapshots of the development version are available in Sonatype's snapshots repository.

License

Copyright 2012 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

seismic's People

Contributors

dalinaum avatar dependabot[bot] avatar gmerinojimenez avatar holmes avatar jakewharton avatar patrickfav avatar viliuskraujutis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seismic's Issues

memory leak

In my application I have a feature like Google Maps' shake to feedback so I initialized the seismic inside my BaseActivity and extend every Activity from that. This causes leaks, is there another way to have shake detection in every activity I have?

Not compatible with Galaxy S5?

Samsung overrides motion gestures like shake and it seems like this library is not compatible with their modified Android system. If there is a secret device setting to make it work, please document it.

Seismic

I'm trying to do an app that send you notifications every time a certain seismic wave happens,and send you a notification to your phone if you have the app downloaded.

Add method to change window size

I need to have way more sensitivity.

Half a second, and more than 75 % of samples is not acceptable for my use case. I can pick the phone from table and put it back withou triggering hearShake. And I've senstivity set to 10.

I need to detect the phone flipping over from synchronization cradle.

Set motion sensitivity

I've added this library to my android project, but I'm noticing that I've to shake it very hard to trigger the hearShake method, is there a way to set sensitivity? If not, could such methods be publicly exposed?

Shake is not working on motorola

This is because motorola have a default shake gesture which opens camera. Is there a way to possible override this while using the app?

Can i increase the number of shakes per second?

The results show that the shaking occurs about seven times in two seconds.
However, I want to increase the number of shaking measures.
Can I increase the number of detections per second with the code in the library?

Purge results in less then MIN_QUEUE_SIZE items

The test:

@Test public void testPurge() {
  ShakeDetector.SampleQueue q = new ShakeDetector.SampleQueue();
  q.add(1, true);
  q.add(2, true);
  q.add(3, true);
  q.add(4, true);
  q.add(5, true);
  q.add(6, true);
  q.add(7, true);
  q.add(8, true);
  q.add(9, true);
  assertThat(q.asList()).hasSize(9);
  q.purge(3);
  assertThat(q.asList()).hasSize(7);
  q.purge(8);
  assertThat(q.asList()).hasSize(4); // MIN_QUEUE_SIZE
}

The last assert fails, the size is 3.

Permission HIGH_SAMPLING_RATE_SENSORS required when targeting Android 12

On android 12 a new permission has been added when the sampling rate is set to 0 microseconds. Would be possible to have this value configurable? Are we able to detect the shake gesture with a sampling rate lower than 200 Hz?

The issue that I'm getting right now when initializing the ShakeDetector is this one:

java.lang.SecurityException: To use the sampling rate of 0 microseconds, app needs to declare the normal permission HIGH_SAMPLING_RATE_SENSORS.
        at android.hardware.SystemSensorManager$BaseEventQueue.enableSensor(SystemSensorManager.java:790)
        at android.hardware.SystemSensorManager$BaseEventQueue.addSensor(SystemSensorManager.java:710)
        at android.hardware.SystemSensorManager.registerListenerImpl(SystemSensorManager.java:209)
        at android.hardware.SensorManager.registerListener(SensorManager.java:823)
        at android.hardware.SensorManager.registerListener(SensorManager.java:730)
        at com.squareup.seismic.ShakeDetector.start(ShakeDetector.java:66)
        ...

Incorrect package in class "Demo"

In class "Demo" had next line:

package com.squareup.seismic.sample; 

This is a mistake, the correct value:

package main.java.com.squareup.seismic.sample;

Can't get the ShakeDetector to stop

I put sd.stop(); in onPause(), onDestroy(), and onBackPressed() but when I leave the application and shake the device on my homescreen for example it still performs the specified action.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.