Quick Start Guide for Backendless Geofencing

Click the Geolocation icon to step into the Backendless Geolocation Service.

Click the Geofencing tab to obtain access to the Backendless Geofencing interface.

Create a geofence using the drawing tools (line, rectangle or circle).

Backendless supports three different geopoint events in relationship to a geofence: “On Enter”, “On Stay”, “On Exit”. These events occur when a geopoint (user’s device with your running application) enters, stays in or leaves a geofence. For each event you can configure an action which Backendless executes when an event occurs. A list of these actions is located in a dropdown menu for each event.

To configure a geopoint action choose one from the dropdown menu. For this example, we choose the push notifications to be sent when a geopoint enters the created geofence. Once you click on the title of the chosen action a popup window appears.

Select one of the device types you are configuring the actions for. Enter action configuration information such as: Ticker text, Content title and Content text for your push notification. Click the Save button. The geofence is ready. The next step is to create a client app where device location will be monitored for the geofence events. The Backendless SDK provides that capability.

Now you can create an Android project in which you will add code to engage the configured geofencing actions. You can create the project using:

a third-party software – in this case you have to add backendless.jar to your project. The file is available in the Backendless SDK for Android (You can download the SDK from the GitHub)

the Backendless Platform’s code generator in the Code Generation Section of the Backendless developer console.

9. To connect the created project with the Backendless backend switch to the Manage icon of the Backendless developer console and go to the App Settings section. Copy the default values of Application ID, Android Secret Key and a Version number and paste them into the app initialization code Backendless.initApp( applicationId, secretKey, version)of your created project:

10. Set up the client – side geofence monitoring for your project:

NOTICE: Backendless supports two ways of the geofence monitoring: client – side and server-side monitoring. Remember that the server-side and the client – side monitoring cannot occur simultaneously. If you want to implement the client – side geofence monitoring you should set it up in your project.

To set up the the client-side geofence monitoring for your Android project:

11. Save a geopoint in the Backendless backend geolocation storage. The geopoint will be used to represent the location of your device. The geopoint should be created in your application before the code which starts location monitoring (reviewed later in this guide). Any metadata you add to the geopoint can be used in the geofence actions, however, in the same code below the metadata is added only for the demo purposes.