Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/efraespada/motion-detector
https://github.com/efraespada/motion-detector
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/efraespada/motion-detector
- Owner: efraespada
- Created: 2017-07-19T21:48:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-11T19:24:56.000Z (over 6 years ago)
- Last Synced: 2024-11-09T21:45:25.942Z (2 months ago)
- Language: Java
- Size: 169 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# motion-detector
Motion detection utility that work with [Rotor](https://github.com/rotorlab/core-kotlin) JobService.
Gradle:
```groovy
implementation 'com.efraespada:motiondetector:0.0.6'
```
Manifest:
```xml
```
Initialize:
```java
MotionDetector.initialize(getApplicationContext());// debug logs
MotionDetector.debug(true);// 10 meters accuracy
MotionDetector.minAccuracy(10);// notify location changes when device is moving
MotionDetector.deviceMustBeMoving(true);
``````java
MotionDetector.start(new Listener() {
@Override
public void locationChanged(Location location) {
}
/**
* acceleration changed
*/
@Override
public void accelerationChanged(float acceleration) {
}
/**
* step detected
*/
@Override
public void locatedStep() {}
/**
* step detected
*/
@Override
public void notLocatedStep() {}
/**
*
*/
@Override
public void type(String type) {
}
});
```
Kill service:
```java
MotionDetector.end();
```
Check if service is available:
```java
@Override
protected void onResume() {
super.onResume();
if (MotionDetector.isServiceReady()) {
// service is ready
}
}
@Override
protected void onDestroy() {
MotionDetector.end();
super.onDestroy();
}
```
License
-------
Copyright 2018 Efraín EspadaLicensed 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 athttp://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.