EDIT: Short answer is no. Read post #22 for a bit more info and possible ugly workaround.
I'm having trouble getting the emulator working with geofences. Like, this reference code by @Erel, which works fine on my real phone, doesn't seem to work at all in the emulator. I am pretty new with working with the emulator, so I might have misunderstood something, but I can't figure out what that could be.
It would be great if somebody could help me test that it actually works:
For the record, I'm testing this on a 6 inch emulated device withAPI30 API32 and Play Store. (I don't have the exact name available at the moment.) I should also mention that I have verified, using Google Maps, that when I do the above, the emulated device actually gets its position updated. So everything seems to work fine, it's just that I can't get the geofences to trigger.
UPDATE
To better explain my situation, here's what I installed from SDK Manager (because having an image with Play store would be more like the average users, I thought)
Which looks like this in the AVDManager (I've also tried getting geofences to work using the Platform_28 above, but no success)
And this is what the device looks like:
If one click this button:
A window will show, where one can control lots of stuff with the emulator, such as the location:
And, just to give an example, here's a picture showing me setting the location, and Google Maps showing where it thinks I am:
So it's possible to provide locations for the emulator just fine, it's just that I can't get geofences to trigger.
I'm having trouble getting the emulator working with geofences. Like, this reference code by @Erel, which works fine on my real phone, doesn't seem to work at all in the emulator. I am pretty new with working with the emulator, so I might have misunderstood something, but I can't figure out what that could be.
It would be great if somebody could help me test that it actually works:
- Use the example found at the geofence post
- Change the geofence location in the code to something you know where it is
- Compile as release and install into the emulator, which also automatically runs the app
- Make sure the log in B4A says the app successfully added the geofence
- Drop the app into the background
- Make sure to NOT launch any other apps that request location (like Google Maps etc)
- Open the location settings in the emulator (by pressing the ... icon in the vertical toolbar window to the right)
- Set the position to be near your geofence
- Wait a couple of minutes, did the app react and say that you entered the geofence?
- Set the position to be far away from the geofence
- Wait a couple of minutes, did the app react and say that you exited the geofence?
For the record, I'm testing this on a 6 inch emulated device with
UPDATE
To better explain my situation, here's what I installed from SDK Manager (because having an image with Play store would be more like the average users, I thought)
Which looks like this in the AVDManager (I've also tried getting geofences to work using the Platform_28 above, but no success)
And this is what the device looks like:
If one click this button:
A window will show, where one can control lots of stuff with the emulator, such as the location:
And, just to give an example, here's a picture showing me setting the location, and Google Maps showing where it thinks I am:
So it's possible to provide locations for the emulator just fine, it's just that I can't get geofences to trigger.
Attachments
Last edited: