android / location-samples

Multiple samples showing the best practices in location APIs on Android.
Apache License 2.0
2.7k stars 2.78k forks source link

Geofences sample does not work all the time, and it is hard to understand #197

Open mvolpato opened 5 years ago

mvolpato commented 5 years ago

I tried the Geofence sample as it is on a API 27 Pixel simulator. Faking location sometimes triggers the notifications and sometimes it does not. Nice.

Even worse, I copied the code in an empty project, except for GeofenceErrorMessages, and I removed the notification part in GeofenceTransitionsJobIntentService (I just log when a transition event is received by the service).

I added

<receiver
            android:name=".GeofenceBroadcastReceiver"
            android:enabled="true"
            android:exported="true" />

        <service
            android:name=".GeofenceTransitionsJobIntentService"
            android:exported="true"
            android:permission="android.permission.BIND_JOB_SERVICE" />

to the manifest.

I added permission tag to the manifest. I tested that adding the geofences is successful.

Tested this "new" app on the same simulator, and it does not log any transition event, ever. Is there some other configuration I am missing?

Ulsacom commented 5 years ago

I have this problem how solve?

cwyllie commented 5 years ago

@mvolpato Have you tried using a physical device? I was having similar issues on the simulator, but they all seemed to disappear on an actual device.

pramodit commented 5 years ago

https://github.com/googlesamples/android-play-location/issues/197