question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How i can get activity (walk, run,...) from the plugin for save it in location object ?

See original GitHub issue

Your 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mauron85commented, Dec 12, 2017
0reactions
shyamal890commented, Dec 2, 2017

If .on("activity") fires on change in activity, it would be a great addition.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How i can get activity (walk, run,...) from the plugin for save it in ...
When i try to detect the device activity, an alert show the coordinates and the activity but i want catch the activity type...
Read more >
Cordova Background Location - How i can get activity (walk ...
Cordova Background Location - How i can get activity (walk, run,...) from the plugin for save it in location object? Ionic Native.
Read more >
Detect when users start or end an activity - Android Developers
It might be necessary to design your app to identify when a user starts or stops a particular activity, such as walking, biking,...
Read more >
RuneLite Plugins Everyone Should Be Using - This is My Setup
RuneLite Download Link: https://runelite.net/Jagex's Statement on 3rd Party ...
Read more >
Polylines and Polygons to Represent Routes and Areas
Display a map, using the Maps SDK for Android. Add a <fragment> element to your activity's layout file, activity_maps.xml . This element defines...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found