How can this be tested on an emulator?
Currently I have a Nexus 6P emulator running API 24 and Google Play Services, with the following config.ini file...
avd.ini.encoding=UTF-8
AvdId=Nexus_6P_API_24
abi.type=x86_64
avd.ini.displayname=Nexus 6P API 24
disk.dataPartition.size=800M
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.camera.back=emulated
hw.camera.front=emulated
hw.cpu.arch=x86_64
hw.cpu.ncore=4
hw.dPad=no
hw.device.hash2=MD5:9b564b60b1aebee32c73ded9daa1e620
hw.device.manufacturer=Google
hw.device.name=Nexus 6P
hw.gps=yes
hw.gpu.enabled=yes
hw.gpu.mode=auto
hw.initialOrientation=Portrait
hw.keyboard=yes
hw.lcd.density=560
hw.mainKeys=no
hw.ramSize=1536
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-24/google_apis/x86_64/
runtime.network.latency=none
runtime.network.speed=full
sdcard.size=100M
showDeviceFrame=yes
skin.dynamic=yes
skin.name=nexus_6p
skin.path=/Users/me/Library/Android/sdk/skins/nexus_6p
tag.display=Google APIs
tag.id=google_apis
vm.heapSize=64
I have tested with the "Send" location and the GPX file options in the extended controls with Google Maps running, and can see the user location dot moving indicating that the users location is changing. I have entered the coordinates that correspond to the 2 locations that have geofences, (Android building at 37.420092 -122.083648 and Yerba Buena at 37.784886 -122.402671), and can see the dot jumping to those locations, however no Geofence events are triggered.
I cannot seem to find any Geofence documentation talking about how it ties into mock location, nor can I find any information about whether the location that the extended controls tie into affect mock location or real location in the emulator. Using LocationServices.FusedLocationApi.setMockMode(googleApiClient, true)
to see if that propogates to the LocationServices.GeofencingApi
doesn't seem to have an effect.
The only buried detail that I could find to possibly point in the right direction was this note on the Location Strategies Page
Note: Providing mock location data is injected as GPS location data, so you must request location updates from GPS_PROVIDER in order for mock location data to work.