Skip to content

Instantly share code, notes, and snippets.

@ndurell
ndurell / MyClass.java
Last active Jan 4, 2016
This gist demonstrates how to log an action using the SessionM SDK. Actions trigger achievements which allow to you reward your users for performing actions in your app. Go to http://developer.sessionm.com for more info.
View MyClass.java
package com.sessionm.example;
import com.sessionm.api.SessionM;
public class MyClass {
public void myAwesomeMethod() {
SessionM.getInstance().logAction("demo_action");
}
}
@ndurell
ndurell / MainActivity.java
Last active Jan 4, 2016
This sample activity shows how to extend the SessionM BaseActivity conveinence class.
View MainActivity.java
package test.com.sessionm.app;
import test.com.sessionm.R;
import com.sessionm.api.BaseActivity;
//Just extend the BaseActivity class.
//This will automatically make lifecycle calls for you.
public class MainActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ndurell
ndurell / proguard.cfg
Last active Jan 4, 2016
This show what to add to your proguard config for SessionM.
View proguard.cfg
-dontwarn com.unity3d.player.**
-keep class com.sessionm.ui.** {*;}
@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" />
@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 / 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 / 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 / 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 {