Quick install

Below, you can find step-by-step guides to easily integrate our SDK and get you going. For the full documentation, 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, check the full documentation for the right .gradle depending on the plugin version:

dependencies {
    // other dependencies

    // use compile instead of implementation when using Android Studio 2.x
    implementation 'com.plotprojects:plot-android:3.11.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 31
        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. You can also find an integration example here. Check our Github for additional details.

1. Install the PlotProjects React Native module

npm install plotprojects-react-native-module --save

2. iOS: Add Configuration File

Add plotconfig.json to both the Android and iOS projects

 

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

{

"publicToken": "REPLACE_ME",

"enableOnFirstRun": true

}

 

You can find more information in Step 4 of the iOS Integration guide

3. Android: Add Configuration File

Add plotconfig.json to both the Android and iOS projects

 

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

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

You can find more information in Step 4 of the Android Integration guide

4. Almost Done!

Add the following code to your App.js to initialize the plugin:

 

import PermissionsAndroid from 'react-native';

import Plot from 'plotprojects-react-native-module';

const requestLocationPermission = async () => {
 try {
 if(Platform.OS === "ios") {
 Plot.initialize();
 } else {
 const granted = await PermissionsAndroid.requestMultiple(
 [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
 PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
 PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION]);
 if (granted['android.permission.ACCESS_BACKGROUND_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED
 || granted['android.permission.ACCESS_COARSE_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED
 || granted['android.permission.ACCESS_BACKGROUND_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED
 ) {
 console.log("Location permission granted!");
 Plot.initialize();
 } else {
 console.log("Location permission denied");
 }
 }

} catch (err) {
 console.warn(err);
 }
 };

requestLocationPermission();

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 (Deprecated)

This framework has been deprecated. Integration is still possible, however we no longer offer support or ongoing updates. 

 

Integration for PhoneGap / Cordova / Ionic can be found in our legacy documentation.

More details at our Github.

Appcelerator (Deprecated)

This framework has been deprecated. Integration is still possible, however we no longer offer support or ongoing updates. 

 

Integration for Appcelerator Titanium can be found in our legacy documentation.

Xamarin (Deprecated)

This framework has been deprecated. Integration is still possible, however we no longer offer support or ongoing updates. 

 

Integration for Xamarin can be found in our legacy documentation.

More details at our Github.

Spread the love