Skip to content

Instantly share code, notes, and snippets.

View ndurell's full-sized avatar
🐢

Noah Durell ndurell

🐢
View GitHub Profile
@ndurell
ndurell / MyClass.java
Last active January 4, 2016 16:49
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.
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 January 4, 2016 07:29
This sample activity shows how to extend the SessionM BaseActivity conveinence class.
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 January 4, 2016 07:29
This show what to add to your proguard config for SessionM.
-dontwarn com.unity3d.player.**
-keep class com.sessionm.ui.** {*;}
@ndurell
ndurell / AndroidManifest.xml
Last active January 4, 2016 07:19
The sample manifest shows what to include in your manifest for a SessionM integration.
<?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 January 3, 2016 04:09
This demonstrates how to instantiate and add a portal button to your a view. This uses the SMPortalButton convenience class.
#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 January 3, 2016 04:08
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.
#import "SessionM.h"
@implementation MyClass
- (void)myAwesomeMethod {
SMAction(@"demo_action")
}
@end
@ndurell
ndurell / ExampleAppDelegate.m
Last active January 2, 2016 21:29
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.
//
// ExampleAppDelegate.m
// MyApp
//
//
#import "ExampleAppDelegate.h"
#import "SessionM.h"
@implementation ExampleAppDelegate
@ndurell
ndurell / MainActivity.java
Created December 13, 2013 02:01
This demonstrates how to make lifecycle calls against the SessionM SDK. See http://devdoc.sessionm.com/android/ for more details.
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 {