-1

I want to develop an android app, in which if an user enters a specific area, the id of that area is passed to Firebase database and some values(couple of strings and images) are retrieved and is displayed in the android app. I have seen Google's Geofence API is used to identify whether an user enters a area or not, and if entered, a notification is triggered. In my case, I don't want to send notifications but retrieve specific set of data from Firebase and display it on the app.

Is it possible with Google's Geofence API, and if so how could it be implemented? Some tutorial or links to videos explaining that would be mostly appreciated. And are there any options other than Geofence API that does what I want?

chanaka
  • 167
  • 1
  • 2
  • 10

1 Answers1

0

I'm not sure about any alternative solution, but you're describing a perfect use case for Google's Geofence API. The following example https://developer.android.com/training/location/geofencing.html#java will show you how to:

First, use Geofence.Builder to create a geofence, setting the desired radius, duration, and transition types for the geofence. For example, to populate a list object

...

The following snippet uses the GeofencingRequest class and its nested GeofencingRequestBuilder class to specify the geofences to monitor and to set how related geofence events are triggered:

...

Define an intent for geofence transitions

I won't copy/paste the examples further from the offical documentation, but once you have a basic setup going you can contact Firebase as you would normally do.

If you're stuck, please provide some code showing how far you've got and you'll surely get some more specific help.

AntonyG
  • 753
  • 7
  • 20
  • Thanks @AntonyG I will start this right away. I just got one question. My home activity is the MainActivity.class. I want this code to be in this activity. So once data is retrieved from firebase, is it possible to display that in the mainactivty layout itself without sending that to another activity using intents?? – chanaka Mar 03 '19 at 11:14