Building map and geographical location features into an Android Loyalty app, which includes overlaying store locations on Google Maps, using Geofence to notify the user when the device enters the store proximities.
Displaying Store Locations on Google Maps
For a business app, showing the store locations on maps is very graphical and helpful to the user. The Google Maps Android API provides an easy way to incorporate Google Maps into your Android apps. “Google Maps Android API v2”
Google Maps Android API v2 is part of the Google Play Services API. To create an Android app which uses the Google Maps Android API v2 requires setting up the development environment by downloading and configuring the Google Play services SDK, obtaining an API key, and adding the required settings in your app’s AndroidManifest.xml file.
First you need to set up Google Play Services SDK by following http://hmkcode.com/adding-google-play-services-library-to-your-android-app/
Then you register your project and obtain an API key from Google Developers Console
We have already document on this we can paste or share link
You will need to add the API key in your AndroidManifest.xml file. (Example 2)
Specifying App Settings in the Application Manifest
To use Google Maps Android API v2, some permissions and features are required to be specified as children of the <manifest> element (Example 1). They necessary permissions for network connection should be included, external storage, and access to the location. Also OpenGL ES version 2 feature is needed for the Google Maps Android API.
<uses-permission android:name=”android.permission.ACCESS_MOCK_LOCATION” />
android:value=”copy your API Key here“/>
Activities involved in Create and Add Geofence
- Create geofence objects
- Specify geofence and initial triggers
- Define an Intent for geofence transitions
- Add geofence
- Handle Geofence Transitions
- Stop Geofence Monitoring
GEOFENCE is usually used in the Loyalty and business apps.
If the user is registered in any loyalty app which has geofence feature in it, the user will get the push message when he enters the geofence region.
“Geofence region” it looks like a big technical term, nothing like that, the appropriate area in and around the store is Geofence region.
IMG: Circle Indicates Geofence region
Sample Geofence Notification Message