mauron85 / cordova-plugin-background-geolocation

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
539 stars 409 forks source link

How to test with Android Emulator? #753

Open tsuga opened 2 years ago

tsuga commented 2 years ago

Your Environment

Context

I'm testing the code on the README with Android Emulator.

Expected Behavior

It should update locations when the app goes into the background.

Actual Behavior

I can see following outputs in the Logcat when I put my app into the background.

D/com.tenforwardconsulting.bgloc.DistanceFilterLocationProvider: Location change: Location[gps 33.340862,132.278377 hAcc=5 et=+18783d11h13m43s367ms etAcc=+1ms alt=0.0 vel=0.0 bear=0.0 vAcc=1 sAcc=1 bAcc=30 {Bundle[mParcelledData.dataSize=96]}] isMoving=false
I/com.tenforwardconsulting.bgloc.DistanceFilterLocationProvider: startMonitoringStationaryRegion: lat=33.34086166666666 lon=132.27837666666666 acy=5.0
D/com.tenforwardconsulting.bgloc.DistanceFilterLocationProvider: Entering stationary region
D/AudioTrack: createTrack_l(0): AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 882 -> 1956
D/com.marianhello.bgloc.service.LocationServiceImpl: New stationary BGLocation[gps 33.340862,132.278377 id=null acc=5 t=1622891622366 et=+ë83d11h13m42s366ms alt=0.0 vel=0.0 bear=0.0 radius=5.0 {Bundle[mParcelledData.dataSize=96]} locprov=0]
D/com.marianhello.bgloc.BackgroundGeolocationFacade: Received MSG_ON_STATIONARY

However, after this, I don't see any updates even if I change the location by Emurator's Extended control.

Possible Fix

I assume that the location update is not fired because the device's accelerometer metrics remain the same. But it is the limitation by the Emulator. Is there any way to test without a physical android device?

crhistianramirez commented 2 years ago

If you're using android studio you can emulate location image