Setting up Geofencing for triggering Push Notifications - [Sample: iOS, Android, Unity]

In this tutorial we are going to show how to setup Leanplum for receiving Push Notifications being triggered by moving through Geofences.

Configuring the Push Notification message

In order to be triggered when a specific region is crossed, a Push Notification message needs to be setup with the delivery set to 'Locally triggered' when the user enter (or exit) a region.

 

From here, also Regions can be created passing coordinates and radius or just using the map. 

 

 

iOS

A sample app project already configured is available here

For configuring an iOS project for Geofencing see Location-based messaging

Android

For configuring an Android project for Geofencing see Location-based Messaging.

A sample app project already configured is available here

Beware that for Android, in order to have local Push Notification being triggered also when the App is killed and not running even in background, Leanplum.start needs to be placed in the Application class. 

Regarding AndroidManifest.xml, make also sure that the permissions are present 

<!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>-->
<!--<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>-->and Google Play Services 

 

Permission for using Mock Locations can also be placed for testing purposes:

<!--<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>-->

Unity

For Unity, you have to make sure that what being described for iOS and Android is being also configured in your project. 

To do that you have to modify the Xcode or Android Studio projects as generated when exporting the projects from Unity. 


Was this article helpful?
Have more questions? Submit a request