cordova-motion-plugin v1.0.0
ngMotion README
Overview
Cordova plugin to detect when a user is driving or walking that supports both iOS and Android.
Initialization
The ng-motion
library will be initialized with driving and walking speed thresholds to determine when the tracked GPS motion is fast enough to be considered driving.
Events
The ng-motion
library should emit periodic events when the user is in motion. Each event will contain the following:
- type (walking/driving/motion)
- walking - GPS motion with accelerometer motion that looks like walking, below the walking speed threshold.
- driving - GPS motion that is not walking, above the driving speed threshold
- motion - GPS motion that is not walking or driving
- speed
- heading
- current long/lat
Logic
Walking - The ng-motion
library will determine walking as below a certain speed threshold tracked via GPS motion and use the accelerometer to confirm that the user has walking-like motion. (see reference pedometer code for this)
Driving - The ng-motion
library will determine driving as above a certain speed threshold traced via GPS motion and no exhibiting accelerometer motion consistentant with walking.
Motion - The ng-motion
library will determine motion as any GPS motion that does not qualify as Walking or Driving.
Example
Project will provide an example app using Ionic Framework. This app should listed to the events from the ng-motion
library and display all the even details. It should also allow for adjusting the driving/walking speed thresholds.
References
- ngCordova DeviceMotion- Get access to the device's accelerometer.
- ngCordova DeviceOrientation - Get access to the device's compass.
- ngCordova BackgroundGeoloc - Cross-platform background geolocation for Cordova / PhoneGap with battery-saving "circular region monitoring" and "stop detection".
- ngCordova Geolocation - Grab the current location of the user, or grab continuous location changes:
- Pedometer Code - StackOverflow thread with some useable examples.
- Build a PhoneGap Pedometer Tutorial
- Cordova Pedometer Plugin - looks very promising. An existing Cordova Plugin that provides "pedometer services". This is unfortunately only iOS so will only be usefully as reference.
- "Walkable" Geolocation App - Example app that handles iOS/Android Geolocation features.
7 years ago