Geofence Broadcast Receiver not triggered but when I open the google map, it works
Asked Answered
F

1

3

I am developing an android app based on user location.

So I am using the "Geofence" enter/exit event.

It is not easy to test.

Because to test it, I should move out or in some location.

So I am using the emulator and set virtual location info (lat/lng).

Anyway, I found some info about this feature in here.

So I followed it, using broadcast receiver.

At the first time, It doesn't work. But, when I open "Google Map", my current location starting to change to what I set through the emulator.

And my broadcast receiver is triggered at that time.

But if I don't use "Google Map", nothing happen...

Why? and How can I handle this???

F answered 28/6, 2019 at 13:36 Comment(1)
Provide full code if you got answer!Plantain
F
0

Actually, my app worked fine.

But I added some new feature but it is not related with Geofence.

After the update, geofence doesn't work.

So I checked my commit list and I found something.

I changed dependency library versions.

I didn't find the root cause, but when I rollback the library version like below.

implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'androidx.core:core-ktx:1.2.0-alpha01'

And now, Geofence works fine in background.

F answered 1/7, 2019 at 3:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.