I am trying to test Geofence functionality using Google's example: Creating & Monitoring Geofences. I have uploaded the code here.
Problem is that I never get a notification of entry or exit. I have Wifi, 4G and GPS on. I have tried to test in the following ways:
What am I doing wrong? ANyone had success in running this Google's example: Creating & Monitoring Geofences. I have uploaded the code here for easy browsing.
I am just trying to learn Geofencing - detecting entry & exit. I WILL MARK ANY ANSWER AS THE RIGHT ANSWER THAT I CAN USE TO GET GEOFENCING WORKING ON MY REAL DEVICE
.
You can set up Google Ads geofencing on the ads displayed on search results, display and YouTube. To more specifically target a location, manually enter the location. Google will display the estimated number of users within the geofenced location that meet other criteria that you have defined.
To plot a geofence on the map, all you require are, center coordinates of the circle (latitude, longitude) and radius of the circle. With a GoogleMap object reference, you can use the addCircle() function which expects CircleOptions() object as a parameter.
App developers can use native Android and iOS location detection to power their location-based experiences and engagement. However, native geofencing technology can only deliver accuracy of around 100-200 meters.
I was also having issues with the example code. One of the main issues I had was around declaring the ReceiveTransitionsIntentService. You don't need to add a BroadcastReceiver or request location updates, but you need to change your AndroidManifest to set the exported value to true, like so:
<service
android:name=".ReceiveTransitionsIntentService"
android:exported="true" >
</service>
Make sure that the path to the service is also correct.
I've simplified the Google example significantly and you can find the code and explanation here. I've removed the UI component and persistent Geofence storage, so this example should be easier to follow. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With