Developer Docs

Here you can find shortened documentation for the integration of our plugins and SDK. For the full doumentation please click the button below.

iOS – Swift

Integration with Cocoapods, using Swift. Full documentation here.

1. Update your podfile

Using CocoaPods, add the following to your podfile:

use_frameworks!
pod 'PlotPlugin

2. Run pod install

Run in your terminal:

pod install --repo-update

3. Add usage description

Under the “info” tab in Xcode add the following property list keys and add an description of why you want to acces a users location:

NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription

4. Add configuration file

Add this file as plotconfig.json in the root folder:

{
  "publicToken": "REPLACE_ME",
  "enableOnFirstRun": true
}

5. Add PlotDelegate

Add PlotDelegate to the implemented protocols of your AppDelegate:

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, PlotDelegate

6. Implement AppDelegate

In AppDelegate, add to the func application method:

PlotDebug.initialize(launchOptions: launchOptions, delegate: self

This method must be called before the end of application!

iOS – Objective C

Integration with Cocoapods, using Objective C. Full documentation here.

1. Update your podfile

Using CocoaPods, add the following to your podfile:

use_frameworks!
pod 'PlotPlugin'

2. Run pod install

Run in your terminal:

pod install --repo-update

3. Add usage description

Under the “info” tab in Xcode add the following property list keys and add a description of why you want to acces a users location:

NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription

4. Add configuration file

Add this file as plotconfig.json in the root folder:

{
  "publicToken": "REPLACE_ME",
  "enableOnFirstRun": true
}

5. Add PlotDelegate

Add PlotDelegate to the implemented protocols of your AppDelegate in the header(.h) file:


#import <PlotProjects/Plot.h> @interface AppDelegate : UIResponder<UIApplicationDelegate, PlotDelegate>

6. Implement AppDelegate

In the implementation file (.m) of your AppDelegate, in the method didFinishLaunchingWithOptions call:

[Plot initializeWithDelegate:self];

The initialize method must be called before the end of that method.

Android

Integration with Maven repository. Full documentation here.

1. Integrating the Maven repository

To allow the Plot Projects Android plugin to be found, add the Plot Projects Maven repository to your build.gradle:

allprojects {
    repositories {
        google()
        jcenter()
        
        // allow gradle to find the Plot Projects Plugin
        maven {
            url 'https://maven-repo.plotprojects.com'
        }
    }
}

2. Add Plot Projects Android plugin

Add the Plot Projects Android plugin as a dependency in your app/build.gradle:

dependencies {
    // other dependencies

    // use compile instead of implementation when using Android Studio 2.x
    implementation 'com.plotprojects:plot-android:3.10.0'
    implementation 'androidx.core:core:1.1.0'
    implementation 'androidx.fragment:fragment:1.1.0'
    implementation 'androidx.work:work-runtime:2.2.0'
    implementation 'androidx.work:work-gcm:2.2.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-nearby:17.0.0'
    implementation 'com.google.firebase:firebase-core:17.2.1'
    implementation 'com.google.firebase:firebase-messaging:20.0.1'
    implementation 'com.google.android.gms:play-services-awareness:17.1.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
}

3. Set minimum supported Android version

Set the minSdkVersion version to at least 16 in your app/build.gradle:

android {
    // other android specific gradle configuration

    defaultConfig {
        applicationId "com.myplotapplication"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }   
}

4. Define configuration file

Plot uses a configuration file which you have to define (or create) as assets/plotconfig.json:

{
    "publicToken": "REPLACE_ME",
    "enableOnFirstRun": true,
    "debug": true,
    "showOnGoingNotification": "during_network_request",
    "enableCombinedMonitoring": "false"
}

5: Almost Done!

Call Plot.init(context) to initialize the plugin from your main Activity onCreate method:


Plot.init(this); // add this line initialize the Plot Plugin

React Native

Installing the Plot plugin into your React Native app. Full documentation here. More details at our Github.

1. iOS & Android

Since we're working with the native variant of React, the necessary steps to integrate the Plot plugin are the same as in a native iOS or Android app.

Flutter

Installing the Plot plugin into your Flutter app. Full documentation here. More details at our Github.

1. iOS integration

Since we interact with the native components, the necessary steps to integrate the Plot plugin are the same as for a native iOS app. To open the platform-specific code, select from the menu: Tools > Flutter > Open iOS module in XCode. The rest of the steps are in the iOS integration guide.

2. Android integration

Since we interact with the native components, the necessary steps to integrate the Plot plugin are the same as for a native Java app. To open the platform-specific code, select from the menu: Tools > Flutter > Open for editing in Android Studio. The rest of the steps are in the Android integration guide.

Phonegap

Installing the Plot plugin into your PhoneGap / Cordova / Ionic app. Full documentation here. More details at our Github.

1. Get The Plugin

Add the following line to config.xml to add our plugin:


<gap:plugin name="cordova-plotprojects" source="npm" version="3.x" />

Or you can add the plugin to an existing project with this command using PhoneGap:


phonegap plugin add cordova-plotprojects

Or if you are using Cordova/Ionic:


cordova plugin add cordova-plotprojects

1. Get The Plugin

Add the following line to config.xml to add our plugin:


<gap:plugin name="cordova-plotprojects" source="npm" version="3.x" />

Or you can add the plugin to an existing project with this command using PhoneGap:
phonegap plugin add cordova-plotprojects

Or if you are using Cordova/Ionic:


cordova plugin add cordova-plotprojects

2. Add Configuration File

Add a configuration file in the www/ folder and name the file plotconfig.json.

Add the following:

{
    "publicToken": "REPLACE_ME",
    "enableOnFirstRun": true
}

3. Almost Done!

Initialize the Plot library using the following snippet:

<script type="text/javascript">// <![CDATA[ document.addEventListener("deviceready", deviceReady, true); function deviceReady() { var plot = cordova.require("cordova/plugin/plot"); plot.init(); } // ]]></script>

Appcelerator

Installing the Plot plugin into your Appcelerator Titanium app. Full documentation here. More details at our Github.

1. Download The Zip

Go to our download page where the plugin can be obtained as a .zip file found under "Appcelerator Titanium Module".

2. Install in Appcelerator Studio

Open Appcelerator Studio, in the Help menu, select Install Mobile Module. Insert the .zip file obtained in the previous step.

3. Add Configuration File

Add a configuration file in the assets folder and name the file plotconfig.json.


<script type="text/javascript">// <![CDATA[ document.addEventListener("deviceready", deviceReady, true); function deviceReady() { var plot = cordova.require("cordova/plugin/plot"); plot.init(); } // ]]></script>

4. Set iOS permission rationale

Add the following lines to tiApp.xml at the ios/plist/dict element:


<key>NSLocationAlwaysUsageDescription</key> <string>The app uses your location in order to inform you about special offers in nearby stores.</string> <key>NSLocationWhenInUseUsageDescription</key> <string>The app uses your location in order to filter information shown based on what's near you.</string> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>The app uses your location in order to inform you about special offers in nearby stores and customize its content based on what's near.</string>

5. Almost Done!

Add the snippet below to one of your scripts used to initialize your application. You usually do this in app.js or alloy.js:


var plot = require('com.plotprojects.ti'); plot.initPlot({ notificationFilterEnabled: false });

Xamarin

Installing the Plot plugin into your Xamarin app. Full documentation here. More details at our Github.

1. Both iOS & Android

Instal our plugin through NuGet as it automatically ensures the right version.

2. Android Only

Place and configure plotconfig.json in the Assets folder of your Android project:

{
"publicToken": "REPLACEME",
"enableOnFirstRun": true
}

Call the following from the OnCreate method of one of your activities:

PlotProjects.Plugin.Plot.GetInstance(activity)

For any issues consult our documentation.

3. iOS Only

Place and configure plotconfig.json in the Resources folder of your Android project:

{
"publicToken": "REPLACEME",
"enableOnFirstRun": true
}

Add the following line to your FinishedLaunching method in your AppDelegate:

PlotProjects.Plugin.Plot.GetInstance(launchOptions, true);

4. iOS Only set permission rationale

Add the following lines to tiApp.xml at the ios/plist/dict element:

NSLocationAlwaysUsageDescription
The app uses your location in order to inform you about special offers in nearby stores.
NSLocationWhenInUseUsageDescription
The app uses your location in order to filter information shown based on what's near you.
NSLocationAlwaysAndWhenInUseUsageDescription
The app uses your location in order to inform you about special offers in nearby stores and customize its content based on what's near.

5. Almost Done!

Add the snippet below to one of your scripts used to initialize your application. You usually do this in app.js or alloy.js:

var plot = require('com.plotprojects.ti');
plot.initPlot({ notificationFilterEnabled: false });