Skip to content

Instantly share code, notes, and snippets.

View PresentActivityActivity.java
package ludia.sessionm;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.sessionm.api.ActivityListener;
import com.sessionm.api.BaseActivity;
import com.sessionm.api.SessionM;
import org.json.JSONException;
import org.json.JSONObject;
@ndurell
ndurell / AndroidManifest.xml
Last active Aug 29, 2015
This shows the permissions that are needed to add to your AndroidManifest.xml for integrating the SessionM SDK.
View AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.com.sessionm"
android:versionCode="15"
android:versionName="1.9.0 Beta" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<!-- Begin SessionM -->
@ndurell
ndurell / SessionM.xml
Created Feb 18, 2014
This gist shows the components that need to be included in your <application> tag for SessionM integration.
View SessionM.xml
<receiver android:name="com.sessionm.api.ConnectionReceiver" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" >
</action>
</intent-filter>
</receiver>
<activity
android:name="com.sessionm.ui.SessionMActivity"
android:configChanges="keyboard|orientation|screenSize"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
@ndurell
ndurell / DialogAchievementActivity.java
Last active Aug 29, 2015
Below is a sample custom achievement. It uses an alert dialog to display the achievement information. This is meant to illustrate how to make custom achievement API calls and shouldn't be used in a real app.
View DialogAchievementActivity.java
package test.com.sessionm.app;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.util.Log;
import com.sessionm.api.AchievementData;
import com.sessionm.api.AchievementActivity;
import com.sessionm.api.AchievementActivityIllegalStateException;
import com.sessionm.api.SessionM;
@ndurell
ndurell / AppDelegate.m
Last active Aug 29, 2015
How to turn on logging.
View AppDelegate.m
//
// ExampleAppDelegate.m
// MyApp
//
//
#import "ExampleAppDelegate.h"
#import "SessionM.h"
@implementation ExampleAppDelegate
@ndurell
ndurell / MainActivity.java
Created Dec 13, 2013
This demonstrates how to make lifecycle calls against the SessionM SDK. See http://devdoc.sessionm.com/android/ for more details.
View MainActivity.java
package com.example.sessionmexamplelifecyclecalls;
import com.sessionm.api.SessionM;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@ndurell
ndurell / ExampleAppDelegate.m
Last active Jan 2, 2016
This demonstrates how to start a session with the SessionM iOS SDK. The recommended place to do this is in your application delegate as shown in this example. Please visit http://developer.sessionm.com for more details.
View ExampleAppDelegate.m
//
// ExampleAppDelegate.m
// MyApp
//
//
#import "ExampleAppDelegate.h"
#import "SessionM.h"
@implementation ExampleAppDelegate
@ndurell
ndurell / MyClass.m
Last active Jan 3, 2016
This code demonstrates how to log an action. Logging actions allows you to award your users with mPOINTs for completing tasks within your app. In this case we are logging the action "demo_action" anytime the method "myAwesomeMethod" is called.
View MyClass.m
#import "SessionM.h"
@implementation MyClass
- (void)myAwesomeMethod {
SMAction(@"demo_action")
}
@end
@ndurell
ndurell / MyViewController.m
Last active Jan 3, 2016
This demonstrates how to instantiate and add a portal button to your a view. This uses the SMPortalButton convenience class.
View MyViewController.m
#import "SMPortalButton.h"
@implementation MyViewController
- (void)viewDidLoad
{
[super viewDidLoad];
SMPortalButton *portalButton=[SMPortalButton buttonWithType:UIButtonTypeSystem];
[portalButton.button setTitle:@"Portal Button" forState:UIControlStateNormal];
portalButton.frame = CGRectMake(40, 40, 100, 30);
@ndurell
ndurell / AndroidManifest.xml
Last active Jan 4, 2016
The sample manifest shows what to include in your manifest for a SessionM integration.
View AndroidManifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sessionm.sample"
android:versionCode="1"
android:versionName="1.0.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<!-- SessionM NOTE: These permissions are required for SessionM -->
<uses-permission android:name="android.permission.INTERNET" />