kacsagit
kacsagit

Reputation: 65

Android geofencing not working as a service

I tried making my first geofencing app following google's tutorial and this tutorial http://www.coderzheaven.com/2016/06/20/geofencing-in-android-a-simple-example/ It works great when the app is open, but when I close the app I get no notification. So I tried running just the tutorial code and it had the same problem. However I noticed that when my app was running(which implemets geofencing the same way) and the tutorial was closed the tutorial's service worked becuase I got the notification from the tutorial.(Same thing if the tutorial was open and my app closed) What is wrong with the tutorial code?

Upvotes: 1

Views: 3148

Answers (1)

Akash Bisariya
Akash Bisariya

Reputation: 4764

Intent service used in the mentioned example works good if your app is in foreground but when the app is in background, this IntentService is never called.So we need to use Broadcast-Receiver instead of Intent service.

I found this blog helpful in getting solution.

http://davehiren.blogspot.in/2015/01/android-geofence-stop-getting.html

Upvotes: 3

Related Questions