Setting up a GeoFence



Introduction

GeoFencing allows iOS apps to trigger Actions in a defined area of meters from a longitude/latitude point. 


To access Geofencing we use Proximity Fence actions in EachScape Studio.


To setup a Geofence you'll need to first click on the 3 dots next to your app name and then click "Configure" from the menu.




Then go to the "Events" tab in the next view.

 



The first Action that needs to be setup is "Create Proximity Fence". This will define the center location with longitude/latitude and the amount of meters around that central location that will cause other events to trigger. These events can be defined when you enter or exit the defined area around the central longitude/latitude. This Action in this example is setup in the Edit App/Actions section of the Builder but you can define this Action anywhere that you want.


The following fields need to be defined.


1. Proximity Fence ID

- This is a number assigned to your Geolocation. Each defined location must have a unique number assigned to it. You can set up to 20 regions so the value can be 1-20.


2. Latitude/Longitude

- These values define the center point of your geolocation. There are several methods to get a longitude/latitude of a location. Here is a website that does it for you but there are many methods: Latitude and Longitude of a Point.


3. Radius

The defined area around the central longitude/latitude that will trigger your Actions in the app.




Once you have defined your Geolocation you will need Actions entered in the Events tab. "Proximity Fence Entered" and "Proximity Fence "Exited". You can enter Actions for either one or both of these values.




The first thing that needs to be done in the section "Proximity Fence Entered" is define your Proximity Fence action as a Variable. We use the action. "Set a Variable".


In this example we call the Variable "regionID" but you can give this Variable any name you want. We assign the following value to this variable: [[prop:location/triggeredProximityFence/identifier]]



The second thing that needs to be done is to use the Action "Post Local Notification".


The following fields need to be filled out in this Action.

Message

- This is the message to be displayed when the user enters the defined Geofence area. 

Action Name

- Describes the Action performed by opening the notification to the user. Used for the button or slider text in iOS

Script

- You can define any Action/Actions to trigger by using a Custom Script.

When (optional)

- Here you can define a Conditional action. For example the Variable we defined above lets us define this action based on it's ID. This technique can be used to trigger different text or Actions for each Geofence ID.


In this example we have a conditional Notification for Proximity Fence ID 2



The Action "Post Local Notification" can be used in the Event "Proximity Fence Exited" as well as "Proximity Fence Entered".