Closed TARJr closed 1 month ago
What is the start timestamp where this behaviour begins?
Continuous posts start here:
05-31 22:23:26.908
On Wed, Jun 1, 2022 at 10:23 AM Chris Scott @.***> wrote:
What is the start timestamp where this behaviour begins?
— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1354#issuecomment-1143678254, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5JMURNNQJLNMKTCSHZNLVM5W4ZANCNFSM5XRLAR6Q . You are receiving this because you authored the thread.Message ID: <transistorsoft/cordova-background-geolocation-lt/issues/1354/1143678254@ github.com>
Have you been using a Mock Location app on that device?
Plugin version: 4.4.2
I've been making a lot of changes wrt Android 12 lately. I suggest you test Android 12 on the latest version 4.7.1
.
Not sure what a Mock location app would be.
On Wed, Jun 1, 2022 at 10:53 AM Chris Scott @.***> wrote:
Have you been using a Mock Location app on that device?
— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1354#issuecomment-1143713194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5JMTY43TZCLDUZ4SYCZDVM52NHANCNFSM5XRLAR6Q . You are receiving this because you authored the thread.Message ID: <transistorsoft/cordova-background-geolocation-lt/issues/1354/1143713194@ github.com>
Why are you doing this? the onMotionChange
delivers a high-quality location to event.location
. Doing a getCurrentPosition()
there is probably just going to give you the exact location that was delivered to event.location
.
BackgroundGeolocation.onMotionChange((event) => {
if (event.isMoving) {
console.error('[onMotionChange] Device has just started MOVING ', event.location);
this.logger.info(`BackgroundGeolocationProvider:: MOVING`);
BackgroundGeolocation.getCurrentPosition({
samples: 1,
persist: true
}).then((location) => {
console.log('[getCurrentPosition] ', location);
});
} else {
console.log('[onMotionChange] Device has just STOPPED: ', event.location);
}
});
Show me your platforms/android/project.properties
Studio Gradle projects
target=android-29 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.gradle.include.1=cordova-plugin-background-fetch/txxxx-build.gradle cordova.system.library.1=com.google.android.gms:play-services-location:18.+ cordova.system.library.2=androidx.appcompat:appcompat:1.2.0 cordova.system.library.3=com.squareup.okhttp3:okhttp:3.12.+ cordova.system.library.4=org.greenrobot:eventbus:3.2.0 cordova.system.library.5=io.github.nishkarsh:android-permissions:0.1.8 cordova.system.library.6=org.slf4j:slf4j-api:1.7.25 cordova.system.library.7=com.github.tony19:logback-android:2.0.0 cordova.gradle.include.2=cordova-background-geolocation-lt/xxxxx-build.gradle cordova.system.library.8=com.google.android.play:core:1.8.0 cordova.gradle.include.3=cordova-support-google-services/xxxxx-build.gradle cordova.gradle.include.4=phonegap-plugin-multidex/xxxxx-multidex.gradle cordova.system.library.9=androidx.legacy:legacy-support-v13:1.0.0 @.*** cordova.system.library.11=com.google.firebase:firebase-messaging:17.0.+
On Wed, Jun 1, 2022 at 11:07 AM Chris Scott @.***> wrote:
Show me your platforms/android/project.properties
— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1354#issuecomment-1143730775, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5JMQYO43DLPOZAZSFCBTVM54C5ANCNFSM5XRLAR6Q . You are receiving this because you authored the thread.Message ID: <transistorsoft/cordova-background-geolocation-lt/issues/1354/1143730775@ github.com>
I'm going to take that out, it was put in for testing.
On Wed, Jun 1, 2022 at 11:01 AM Chris Scott @.***> wrote:
Why are you doing this? the onMotionChange delivers a high-quality location to event.location. Doing a getCurrentPosition() there is probably just going to give you the exact location that was delivered to event.location.
BackgroundGeolocation.onMotionChange((event) => { if (event.isMoving) { console.error('[onMotionChange] Device has just started MOVING ', event.location); this.logger.info(
BackgroundGeolocationProvider:: MOVING
); BackgroundGeolocation.getCurrentPosition({ samples: 1, persist: true }).then((location) => { console.log('[getCurrentPosition] ', location); });} else { console.log('[onMotionChange] Device has just STOPPED: ', event.location); } });
— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1354#issuecomment-1143722991, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5JMSRGDARDO5O7JFOJVLVM53M3ANCNFSM5XRLAR6Q . You are receiving this because you authored the thread.Message ID: <transistorsoft/cordova-background-geolocation-lt/issues/1354/1143722991@ github.com>
I believe the issue started here:
App is terminated.
05-31 13:06:01.065 INFO [TSScheduleManager oneShot]
⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
05-31 13:06:01.131 DEBUG [BackgroundGeolocation a]
🔴 Cleared callbacks
05-31 13:06:01.140 INFO [BackgroundGeolocation$m0 run]
╔═════════════════════════════════════════════
║ MainActivity was destroyed
╠═════════════════════════════════════════════
╟─ stopOnTerminate: false
╟─ enabled: true
Location updates are turned ON:
05-31 13:06:05.596 INFO [TSLocationManager requestLocationUpdates]
🎾 Location-services: ON
Motion Transition STILL
occurs:
05-31 13:06:05.777 INFO [ActivityRecognitionService a]
╔═════════════════════════════════════════════
║ Motion Transition Result
╠═════════════════════════════════════════════
╟─ 🎾 ENTER: still
╚═════════════════════════════════════════════
TrackingService
receives motionchange: false
event:
05-31 13:06:07.417 INFO [TrackingService h]
╔═════════════════════════════════════════════
║ TrackingService motionchange: false
╠═════════════════════════════════════════════
But there is no 🔴 Location-services: OFF
message, therefore, Location-updates remain updating.
I believe there is a bug here related to Android 12 and the new long-lived foreground-services. I will guard against this case. Though it may work better in latest version.
Thanks. I'll wait for the updated fix.
On Wed, Jun 1, 2022 at 12:46 PM Chris Scott @.***> wrote:
I believe the issue started here:
05-31 13:06:01.065 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588) 05-31 13:06:01.131 DEBUG [BackgroundGeolocation a] 🔴 Cleared callbacks 05-31 13:06:01.140 INFO [BackgroundGeolocation$m0 run] ╔═════════════════════════════════════════════ ║ MainActivity was destroyed ╠═════════════════════════════════════════════ ╟─ stopOnTerminate: false ╟─ enabled: true
Location updates are turned ON:
05-31 13:06:05.596 INFO [TSLocationManager requestLocationUpdates] 🎾 Location-services: ON
Motion Transition STILL occurs:
05-31 13:06:05.777 INFO [ActivityRecognitionService a] ╔═════════════════════════════════════════════ ║ Motion Transition Result ╠═════════════════════════════════════════════ ╟─ 🎾 ENTER: still ╚═════════════════════════════════════════════
TrackingService receives motionchange: false event:
05-31 13:06:07.417 INFO [TrackingService h] ╔═════════════════════════════════════════════ ║ TrackingService motionchange: false ╠═════════════════════════════════════════════
But there is no 🔴 Location-services: OFF message, therefore, Location-updates remain updating.
I believe there is a bug here related to Android 12 and the new long-lived foreground-services. I will guard against this case. Though it may work better in latest version.
— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1354#issuecomment-1143864238, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5JMULM6XDT2SVD7ILEH3VM6HU3ANCNFSM5XRLAR6Q . You are receiving this because you authored the thread.Message ID: <transistorsoft/cordova-background-geolocation-lt/issues/1354/1143864238@ github.com>
It will arrive first in the private repo, not the public npm version you’re using.
Not sure this is related, but location was not updating for several hours, should have (same phone), had to reset BG: last update was 17:11:32
╔═════════════════════════════════════════════ ║ Motion Transition Result ╠═════════════════════════════════════════════ ╟─ 🎾 ENTER: still ╚═════════════════════════════════════════════ 06-06 17:11:32.273 DEBUG [AbstractService a] ⚙️︎ finish ActivityRecognitionService [eventCount: 0, sticky: false] 06-06 17:11:32.339 INFO [HttpService$i onResponse] 🔵 Response: 201 06-06 17:11:32.340 DEBUG [b destroy] ✅ DESTROY: 534f7811-e9d7-42ab-b34a-61ddec5d5222 06-06 17:11:32.344 INFO [BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 181 06-06 17:11:32.345 DEBUG [AbstractService a] ⚙️︎ finish BackgroundTaskService [eventCount: 0, sticky: false] 06-06 17:11:32.346 DEBUG [AbstractService onDestroy] 🔴 BackgroundTaskService destroyed 06-06 17:11:32.435 DEBUG [AbstractService onDestroy] 🔴 LocationRequestService destroyed 06-06 17:11:32.531 DEBUG [AbstractService onDestroy] 🔴 ActivityRecognitionService destroyed 06-06 17:11:39.691 INFO [TSScheduleManager oneShot] ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588) 06-06 17:11:49.916 INFO [ScheduleEvent onOneShot] ╔═════════════════════════════════════════════ ║ ⏰ OneShot event fired: TERMINATE_EVENT ╠═════════════════════════════════════════════
06-06 17:11:49.920 DEBUG [TerminateEvent
06-06 17:25:10.875 DEBUG [TerminateEvent
06-06 17:40:46.312 DEBUG [TerminateEvent
06-06 17:49:30.879 DEBUG [TerminateEvent
06-06 22:43:02.583 DEBUG [TerminateEvent
Are you doing something in the app pause
/ resume
events?
Just logging events, nothing else being done:
this.resumeSubscription = this.platform.resume.subscribe(async () => {
logger.info('App:onResume');
On Tue, Jun 7, 2022 at 10:04 AM Chris Scott @.***> wrote:
Are you doing something in the app pause / resume events?
— Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/1354#issuecomment-1148722528, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5JMV3YQNFKDVIEO7BD63VN5JH7ANCNFSM5XRLAR6Q . You are receiving this because you authored the thread.Message ID: <transistorsoft/cordova-background-geolocation-lt/issues/1354/1148722528@ github.com>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Your Environment
cordova -v
): 10.1.2cordova platform ls
):#ready
:type TProviderStatus = 'on' | 'off' | null;
type TProviderState = { status: TProviderStatus, changeEvent: ProviderChangeEvent, phoneMac: string, };
@Injectable() export class BackgroundGeolocationProvider { public $providerState: ReplaySubject<TProviderState | null> = new ReplaySubject(1); public $providerChanged: Subject = new Subject();
private _providerState: TProviderState | null;
private phoneMac: string;
}
background-geolocation (4).log