I've been working with the LocationClient
and have setup a Geofence
, but don't know how to test it.
The issue comes from the fact that you can't run the app in an emulator, because LocationClient
uses GooglePlayServices
which are unavailable in an emulator. You also can't use MockLocations
as far as I know, because you use MockLocations
by creating a Provider, and LocationClient
doesn't let you set a Provider.
So... how am I supposed to test my Geofence
? (Besides getting in the car...).
Most phones have a debug setting to enable mocking the location.
For example on my Samsung S3 it's under
Settings->Developer options->Allow mock locations
After turning this on you need an app from the play store that sets the location.
As an example https://play.google.com/store/apps/details?id=com.lexa.fakegps&hl=en
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.