How i can get activity (walk, run,...) from the plugin for save it in location object ?
See original GitHub issueYour Environment
-
Plugin version: 2.2.5
-
Platform: iOS & Android
-
OS version: iOS 10.3.2 / Android 7.0
-
Device manufacturer and model: iPhone 5S / Galaxy S6 edge
-
Cordova version (
cordova -v
): 7.0.1 -
Cordova platform version (
cordova platform ls
): ios 4.4.0 / android 6.2.3 -
Plugin configuration options: // Background Tracking let config = {
// Both (Android & iOS) desiredAccuracy : 10, stationaryRadius : 50, // Stationary radius in meters. When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage. distanceFilter : 30, // The minimum distance (measured in meters) a device must move horizontally before an update event is generated. @see Apple docs. debug : true, // enable this hear sounds for background-geolocation life-cycle. stopOnTerminate : false, // enable this to clear background location settings when the app terminates startOnBoot : false, // Start background service on device boot. (default false) notificationTitle : 'Background tracking', geofenceProximityRadius : 1000, triggerActivities : 'on_foot, walking, running, on_bicycle, in_vehicle, still', // maxLocations : 10000 // Limit maximum number of locations stored into db (default: 10000) // Only for Android (Detect activity for Android) locationProvider : this.backgroundGeolocation.LocationProvider.ANDROID_ACTIVITY_PROVIDER, interval : 10000, // Rate in milliseconds at which your app prefers to receive location updates. @see android docs fastestInterval : 5000, // Fastest rate in milliseconds at which your app can handle location updates. @see android docs. activitiesInterval : 300000, // Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life. stopOnStillActivity : true, // stop() is forced, when the STILL activity is detected (default is true) // Only for iOS (Detect activity for iOS) activityType : 'AutomotiveNavigation', activityRecognitionInterval: 5000, stopTimeout : 5, locationAuthorizationAlert: { titleWhenNotEnabled: "Yo, location-services not enabled", titleWhenOff : "Yo, location-services OFF", instructions : "You must enable 'Always' in location-services, buddy", cancelButton : "Cancel", settingsButton : "Settings" } };
Context
When i try to detect the device activity, an alert show the coordinates and the activity but i want catch the activity type for link it in my location object.
like that:
var currentPosition = { ‘latitude’ : position.latitude, ‘longitude’ : position.longitude, ‘altitude’ : null, ‘accuracy’ : position.accuracy, ‘altitude_accuracy’ : null, ‘heading’ : null, ‘speed’ : null, ‘timestamp’ : position.time, ‘activity’ : position.activity.type || null, ‘activity_confidence’: position.activity.confidence || null }
If someone can help me ? Thanks a lot =)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@shyamal890 fyi on “activity” event Implemented in 3.0.0-alpha.8
https://github.com/mauron85/cordova-plugin-background-geolocation#activity-event
If
.on("activity")
fires on change in activity, it would be a great addition.