Skip to content

Integrating predict.io Cordova Android Plugin

ahmadarbisoft edited this page Oct 24, 2016 · 5 revisions

To install the plugin, follow these steps:

  • Make sure your computer environment is set for latest Cordova.
  • Add predict.io plugin to your project (command-line: cordova plugin add https://github.com/predict-io/PredictIO-Cordova.git command in your-project-name\ folder)
  • Add the following meta-data tag in application tag of AndroidManifest.xml file and replace YOUR_API_KEY with the one provided by PredictIO
    <meta-data android:name="io.predict.sdk.API_KEY" android:value="YOUR_API_KEY" />
  • To begin tracking, you would need to call start method
  • Build (command-line: cordova build android) in your-project-name\ folder
  • Run (command-line: cordova run android) in your-project-name\ folder

Note: If the app is killed by OS or closed by pressing the back button, javascript methods would not fire until the app is reopened. For more details Cordova Android Lifecycle