Closed tushaagit closed 2 weeks ago
⚠️ Cannot start motion-activity updates: permission is denied
Motion api requires runtime permission from the user. In the logs you’ve shown, the user did not authorize “Health and Fitness” permission.
therefore, the only way the plugin can detect the device is moving is via exiting a geofence around the last known position, requiring movement of at least 200 meters before tracking engages.
Thanks for such a quick response Sir, Just want to clear one thing, i haven't came across any health and fitness permission, but if you are referring to Physical activity permission, it was ON (Allow)
Physical activity permission
Yes, it's that.
it was ON (Allow)
The plugin could not receive permission to start the motion api.
⚠️ Cannot start motion-activity updates: permission is denied
But sir what could be the solution for this, physical activity was already allowed while installing the app, and throughout the whole journey, the device was not opened or any permission was not altered afterwards, still it started capturing locations after sometime, what can be done programmatically to get it working from the start as soon as the bg geo location starts.
Attaching the whole log for your reference,
background-geolocation_TransistorSoft.log
what could be the solution for this, physical activity was already allowed while installing the app
Your app does not have physical activity permission. You think it does, but it does not.
Have you recently updated your targetSdkVersion
? Have your read about the new runtime permission requirement for Physical Activity introduced in Android 10? The plugin automatically includes all necessary permissions and will automatically show the permission dialog when the app is launched.
still it started capturing locations after sometime,
As I said above: "therefore, the only way the plugin can detect the device is moving is via exiting a geofence around the last known position, requiring movement of at least 200 meters before tracking engages."
The plugin uses a geofence as a secondary triggering mechanism.
Have you recently updated your targetSdkVersion? - Yes,
The plugin automatically includes all necessary permissions and will automatically show the permission dialog when the app is launched. - Yes, it shows the physical activity permission without fail, and we developers always keep it as Allow.
Also it captures the location points correctly as specified in config i.e distanceFilter = 50, only issue comes when device changes its state from still to active, location updates take time to record, but we are sure that being a developer we always try to allow every permission, and physical activity is one of it,
Still i am adding below permission in manifest, lets see if it makes any difference. android.permission.ACTIVITY_RECOGNITION
Thanks Sir
I told you: "The plugin automatically includes all necessary permissions and will automatically show the permission dialog when the app is launched."
You DO NOT need to manually add the permission android.permission.ACTIVITY_RECOGNITION
.
Here are all the permissions automatically included into your app by the plugin:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
Yes Sir, those permissions come automatically, please check my latest attached log, check specifically between 7:50 pm to 8:45 pm IST, all permissions accepted including physical activity, also confirmed it in app settings before starting the journey, still it took time to record the first location to external link, exactly at 8:05:14 pm it recorded the first location, while background service was started 10-15 mins before, also crossed a distance of nearly 2km, the in between points not available. Also check the travel path highlighted in yellow color for confirmation
The plugin has no control over when the Motion API fires an event to show that the device is moving.
The Motion API has nothing more than an ON/OFF switch. It is not configurable. There is no way to increase the sensitivity. It's purely up to the OS to fire these events and depends upon the quality of the device and sensors inside it.
The plugin received the first Motion Transition event here:
10-12 20:05:14.358 INFO [ActivityRecognitionService handleActivityTransitionResult]
╔═════════════════════════════════════════════
║ Motion Transition Result
╠═════════════════════════════════════════════
╟─ 🎾 ENTER: in_vehicle
╚═════════════════════════════════════════════
When you test on a variety of devices, you'll find better / worse performance.
You can simulate walking by shaking the device vigorously while watch adb logcat *:S TSLocationManager:V
and/or configure debug: true
so you can hear the plugin enter the moving state.
Also see https://dontkillmyapp.com
We are getting same issue almost on every device we checked, have one query sir, considering that devices take time to get engage in location capturing activity for the first time as per the sensitivity, but once the motion activity is recognized, does this service pauses/stops automatically as and when the still event is found? (As this happens frequently during travel, if device remains still for a while) IF yes can we do some setting to keep the device always active by firing change pace true, etc , we know that battery would be consumed, but at least we can keep it optional and keep that setting, if rigorous tracking is required
does this service pauses/stops automatically as and when the still event is found
See API docs Config.stopTimeout
.
You will get a better idea of what the plugin is doing with debug: true
so you can hear what the plugin is doing.
any progress with this question?
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
BG Geolocation actual tracking takes time to start
Your Environment
Plugin version: 4.8
Platform: Android
OS version: 11
Device manufacturer / model: POCO M3 (M2010J19CI)
Cordova version (
cordova -v
): 11.0.0Cordova platform version (
cordova platform ls
): Installed platforms: android 11.0.0 ios 6.2.0 Available platforms: browser ^6.0.0 electron ^3.0.0 windows ^7.0.0Plugin config provided to
#ready
:bgGeo.setConfig({ url: window.app.config.serviceServicePath + 'RecordUserGeoLocation', params: { "EmployeeID": empID, "UserID": userID, "UserName": userName, "Remarks": "Transistorsoft Recording", "AttendanceID": localStorage.getItem("AttendanceID"), } }