All Projects → pmwisdom → Cordova Background Geolocation Services

pmwisdom / Cordova Background Geolocation Services

Licence: apache-2.0
Background Geolocation For Android and iOS

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Cordova Background Geolocation Services

Fastlane Plugin Cordova
Integrate your Cordova build into your Fastlane setup
Stars: ✭ 100 (-26.47%)
Mutual labels:  cordova
Code Push Server
CodePush service is hot update services which adapter react-native-code-push and cordova-plugin-code-push - 热更新
Stars: ✭ 1,604 (+1079.41%)
Mutual labels:  cordova
Involt
Inject hardware interactions directly into HTML layout.
Stars: ✭ 128 (-5.88%)
Mutual labels:  cordova
Cordova Broadcaster
Cordova Plugin to allow message exchange between javascript and native (and viceversa)
Stars: ✭ 104 (-23.53%)
Mutual labels:  cordova
Cordova Plugin Vibration
Apache Cordova Plugin vibration
Stars: ✭ 109 (-19.85%)
Mutual labels:  cordova
Ionic Typescript Starter
📱 Platform and IDE agnostic starter project for building mobile apps with Ionic and TypeScript.
Stars: ✭ 124 (-8.82%)
Mutual labels:  cordova
Generator Ngx Rocket
🚀 Extensible Angular 11+ enterprise-grade project generator
Stars: ✭ 1,329 (+877.21%)
Mutual labels:  cordova
Fluster App
[DEPRECATED] Fluster, your simple search for roommates
Stars: ✭ 134 (-1.47%)
Mutual labels:  cordova
Cordova Plugin Wkwebview File Xhr
Cordova Plugin for WebView File XHR
Stars: ✭ 116 (-14.71%)
Mutual labels:  cordova
Ionic2 Reddit Reader
Ionic 2 Sample App
Stars: ✭ 128 (-5.88%)
Mutual labels:  cordova
Wifiwizard2
A Cordova plugin for managing Wifi networks (new version of WiFiWizard) - Latest is version 3+
Stars: ✭ 106 (-22.06%)
Mutual labels:  cordova
Cordova Plugin Add Swift Support
🔨 Swiftify your Cordova app !
Stars: ✭ 108 (-20.59%)
Mutual labels:  cordova
Components
MobileUI was created thinking of making your hybrid application faster and smaller since you only install what you are really going to use for UI.
Stars: ✭ 125 (-8.09%)
Mutual labels:  cordova
Ionic Collection
🤘 Looking for about Ionic Framework?
Stars: ✭ 101 (-25.74%)
Mutual labels:  cordova
Cordova Plugin Globalization
Apache Cordova Plugin globalization
Stars: ✭ 131 (-3.68%)
Mutual labels:  cordova
Pdf Generator
Cordova plugin to generate pdf in the client-side
Stars: ✭ 98 (-27.94%)
Mutual labels:  cordova
Chihu2
ionic2-example <吃乎2>混合开发-美食app 🍜 ☕️ 🍦 (This is a support android and apple ionic2 case, a food app)
Stars: ✭ 124 (-8.82%)
Mutual labels:  cordova
Cordova Plugin Mediapicker
cordova android ios mediaPicker support selection of multiple image and video gif ✨ cordova android 和 ios 图片视频选择cordova插件,支持多图 视频 gif,ui类似微信
Stars: ✭ 136 (+0%)
Mutual labels:  cordova
Cordova Plugin Googlemaps
Google Maps plugin for Cordova
Stars: ✭ 1,647 (+1111.03%)
Mutual labels:  cordova
Cordova Node Xcode
Apache cordova
Stars: ✭ 128 (-5.88%)
Mutual labels:  cordova

cordova-background-geolocation-services

Background Geolocation For Android and iOS with pure javascript callbacks.

  • Notice: This plugin needs a maintainer, if anyone is interested please make an issue. I no longer have the means to support this.

What is this?

This plugin is for enabling background geolocation in your cordova project. It was aimed with the specific goal of normalizing the API for android and iOS and retrieving constant location updates in the background until you tell it to stop (If you tell it you want updates every 3 seconds it will give you one every 3 seconds).

I've also included an activity detection API. It is used to save battery life, but you can also retrieve the likelihood of what the user is currently doing (standing still, walking, running, driving, etc).

Changelog :

  • 1.1.0 -Breaking- (If you need the lower swift versions, use 1.0.4)
    • [iOS]: Converted to new Swift Version
    • [iOS]: Fixed some cases where the plugin would keep running in the foreground
  • 1.0.4 New Low GPS mode for increased battery life on iOS
  • 1.0.3 Activity Detection And Much Better Battery Life For iOS!
  • 1.0.2 Error callbacks now correctly funnel through the location register

Techniques used:

Android : Uses Fused Location API and Activity Recognition API to serve location updates endlessly.

iOS : Uses a timer based approach and CoreMotion library to enable endless background tracking.

Setup:

Installation:

Cordova :

cordova plugin add https://github.com/pmwisdom/cordova-background-geolocation-services.git --save

Meteor :

meteor add mirrorcell:background-geolocation-plus

How to use:

This plugin exports an object at

window.plugins.backgroundLocationServices
//Make sure to get at least one GPS coordinate in the foreground before starting background services
navigator.geolocation.getCurrentPosition(function() {
 console.log("Succesfully retreived our GPS position, we can now start our background tracker.");
}, function(error) {
 console.error(error);
});

//Get plugin
var bgLocationServices =  window.plugins.backgroundLocationServices;

//Congfigure Plugin
bgLocationServices.configure({
     //Both
     desiredAccuracy: 20, // Desired Accuracy of the location updates (lower means more accurate but more battery consumption)
     distanceFilter: 5, // (Meters) How far you must move from the last point to trigger a location update
     debug: true, // <-- Enable to show visual indications when you receive a background location update
     interval: 9000, // (Milliseconds) Requested Interval in between location updates.
     useActivityDetection: true, // Uses Activitiy detection to shut off gps when you are still (Greatly enhances Battery Life)
     
     //Android Only
     notificationTitle: 'BG Plugin', // customize the title of the notification
     notificationText: 'Tracking', //customize the text of the notification
     fastestInterval: 5000 // <-- (Milliseconds) Fastest interval your app / server can handle updates
     
});

//Register a callback for location updates, this is where location objects will be sent in the background
bgLocationServices.registerForLocationUpdates(function(location) {
     console.log("We got an BG Update" + JSON.stringify(location));
}, function(err) {
     console.log("Error: Didnt get an update", err);
});

//Register for Activity Updates

//Uses the Detected Activies / CoreMotion API to send back an array of activities and their confidence levels
//See here for more information:
//https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity
bgLocationServices.registerForActivityUpdates(function(activities) {
     console.log("We got an activity update" + activities);
}, function(err) {
     console.log("Error: Something went wrong", err);
});

//Start the Background Tracker. When you enter the background tracking will start, and stop when you enter the foreground.
bgLocationServices.start();


///later, to stop
bgLocationServices.stop();

Known Issues:

Phonegap Build : Swift files are not officially supported as of yet on phonegap build, so if there is a problem installing it in that environment, there isn't anything I can do until they are supported.

Credit!

By the way, credit to Christocracy and his great plugin that inspired this one. It should share the same concepts via javascript.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].