SessionM

Cordova SessionM Plugin
zhenhaolei0.1.00
platforms: android,ios
$ cordova plugin add com.sessionm.cordova.SessionM

SessionM PhoneGap SDK

This plugin allows you to add SessionM achievements to your phonegap app for iOS and Android.

Compatibility: Cordova (PhoneGap) v3.5 or above

Setup Steps

iOS Setup

  1. Go to http://developer.sessionm.com and setup an account.
  2. Create an iOS app and get the key.
  3. Download the SDK and add it to your phone gap project.
  4. Install the SessionM Plugin

    cordova plugin add ../sessionm-phonegapPlugin/
    cordova prepare
  5. Add the following to your root level config.xml allow access to the following URL:

    <access origin="https://*.sessionm.com" />
  6. Add a script tag to your index.html:

  7. Start a session:

    sessionm.phonegap.startSession('your-key-from-above-here');
  8. To log an action call:

    sessionm.phonegap.logAction('myAction');
  9. To present the portal call:

    sessionm.phonegap.presentActivity(2);

Android Setup

Installation

  1. Go to http://developer.sessionm.com and setup an account.
  2. Create an Android app and get the key.
  3. Add the key and permissions to AndroidManifest.xml.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    
    ...
    
    <application>
    <meta-data
    android:name="com.sessionm.appid"
    android:value="your-key-from-above-here" />
    </application>
  4. Download the sessionM SDK and add it to your phone gap project.
  5. Install the SessionM Plugin

    cordova plugin add https://github.com/sessionm/phonegap-plugin
    cordova prepare

Usage

  1. To start a session, put the following javascript in index.js.

    onDeviceReady: function() {
        app.receivedEvent('deviceready');
        sessionm.phonegap.startSession('your-key-from-above-here');
    },
  2. To log an action call:

    sessionm.phonegap.logAction('myAction');
  3. To present the portal call:

    sessionm.phonegap.presentActivity(2);