Blog

Updating to Plot Plugin v1.10.0 from an Older Version

With version 1.10.0 of the Plot Plugin we have changed how the plugin can be initialised and configured. We switched to a file based system for all our supported platforms and frameworks. Our integration guides for both iOS and Android have already been updated, as well as our GitHub pages for Appcelerator and PhoneGap.

In this blog post we will explain the migrating steps to do when updating to Plot Plugin v1.10.0 from an older version. Download for the new version can be found here.

Before going in depth about the changes per platform lets first have a look how a configuration file will look like. We have decided for a JSON format file, which contains your public token and additional configurations. An example file should look something like this:

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

See these links for the respective steps per platform or framework; iOS, Android, Appcelerator and PhoneGap.

iOS

Updating your iOS app requires you to do two things; firstly, create a configuration file as described above and name it plotconfig.json. You have to put it inside the root directory of your app. And secondly, replace

[Plot initializeWithConfiguration:plotConfiguration
                    launchOptions:launchOptions];

with the new initialize function, which drops the configuration and add the delegate:

[Plot initializeWithLaunchOptions:launchOptions
                         delegate:self];

Example code for AppDelegate.m:

#import "AppDelegate.h"
#import <Plot/Plot.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //Initializes the Plot library:
    [Plot initializeWithLaunchOptions:launchOptions delegate:self];
    return YES;
}
@end

Android

Updating your Android app requires you two things; firstly, create a configuration file as described above and name it plotconfig.json. You have to put it inside the assets folder. And secondly, replace the init(context, config) call with just init(context).

Example code for your activity:

public class PlotExample extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Plot.init(this);
    }
}

Appcelerator Titanium

Updating your Appcelerator project requires you to do two things; firstly, create a configuration file as described above and name it plotconfig.json. You have to put it inside the app/assets folder of your project. And secondly, remove the public token from the parameter of the init call.

Your initialization script (usually app.js or alloy.js) should look something like this:

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

PhoneGap / Cordova

Updating your PhoneGap project requires two steps; firstly, create a configuration file as described above and name it plotconfig.json. You have to place it in the www folder inside the application path. Secondly, you have to replace your initialization snippet, you no longer have to create a configuration and pass it into the init function. Just calling plot.init(); is sufficient.

The initialization snippet should then look something like this:

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

Updating from 1.7.* or lower

If you are updating from a plot version older than 1.8.0, please also see the update guide from 1.7.*.

Further information

That’s it! If you followed the steps you should be set up for version 1.10.0 of the Plot Plugin.

If you want to start creating geofences and notifications, get started at our dashboard. For more information check out our documentation.

If you have any questions, please let us know.

Spread the love