Implementing

Native iOS Applications

As framework:

Uncompress and drag and drop the folder AGCrossSelling2.frameworkto your project.

Make sure your project imports the following system frameworks:

  • - CoreGraphics
  • - Foundation
  • - QuartzCore
  • - UIKit

Import the header using:

#import <AGCrossSelling2/AGCrossSelling2.h>

Afterwards, add the following to your application delegate's application:didFinishLaunchingWithOptions:method:


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	// ...
	[AGCrossSelling2 requestWithAppKey:@(123) // Your App Key (see SDK Integration Settings in your app's edit page)
		withNotificationRegister:YES // YES if you want to use push noifications service, NO otherwise
		withNewstand:NO // YES if this app is a newstand app, NO otherwise
		clearBadge:YES
	];
	// ...
}

With this, you will already get basic analytics / trackingdata reported for your app.

If you want to use our Push Notifications system, you must alsoadd the following to your application
delegate's application:didRegisterForRemoteNotificationsWithDeviceToken: method:


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
	// ...
	[AGCrossSelling2 registerNotificationToken:[deviceToken description]];
	// ...
}

Download SDK for IOS: AGCrossSelling2_4.5.4_ios.zip

Native OSX Applications

As framework:

Uncompress and drag and drop the folderAGCrossSelling2OSXFramework.framework to your project.

Make sure your project imports the following system frameworks:

  • - CoreGraphics
  • - Foundation
  • - AppKit

Import the header using:

#import <AGCrossSelling2OSXFramework/AGCrossSelling2OSXFramework>

Afterwards, add the following to your application delegate's applicationdidFinishLaunching:method:


- (void)applicationDidFinishLaunchingWithOptions:(NSNotification *)notif
{
	// ...
	[AGCrossSelling2 requestWithAppKey:@(123) // Your App Key (see SDK Integration Settings in your app's edit page)
		withNotificationRegister:YES // YES if you want to use push noifications service, NO otherwise
		withNewstand:NO // YES if this app is a newstand app, NO otherwise
		clearBadge:YES
	];
	// ...
}

With this, you will already get basic analytics / trackingdata reported for your app.

If you want to use our Push Notifications system, you must alsoadd the following to your application delegate's application:didRegisterForRemoteNotificationsWithDeviceToken:method:


- (void)application:(NSApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
	// ...
	[AGCrossSelling2 registerNotificationToken:[deviceToken description]];
	// ...
}

Make sure to copy the framework in the Build phases

AGCS2OSX
Download SDK forOSX: AGCrossSelling2_4.5.1_osx.zip

Android Applications

Copy agcrossselling2.jar to your project's lib folder

Add the xml directives to you AndroidManifest.xml (seeexample AndroidManifest.xml)

Add Google Play services to your project ( https://developer.android.com/google/play-services/setup.html )

Call the SDK inside ALL of your activities onResume() method (see example TestActivity.java)


protected void onResume() {
	super.onResume();
	// ..
	/*
	 * Starts the AGCrossSelling SDK engine. You should call this inside all of
	 * you activity's onResume() methods.
	 * 
	 * @param appKey
	 *            The application SDK key that can be found on the Edit section
	 *            of your app in the backoffice
	 * @param shouldRegisterForPushNotifications
	 *            A boolean indicating if you want to register for push
	 *            notifications
	 * @param store
	 *            The code of the store where you are distributing your app.
	 *            Only Google is supported for now
	 * @param context
	 *            The context. Don't use getApplicationContext().
	 * @param GCMSenderID
	 *            The Sender ID of your google api console project. This is only
	 *            necessary if you want to receive push notifications through
	 *            our SDK (ignored if shouldRegisterForPushNotifications is
	 *            false)
	 */
	AGCrossSelling2.start(appKey, true, AGCrossSelling2.AGCrossSelling2Store.AGCS2_GOOGLE_STORE, this, "GCM_SENDER_ID");
	// ....
}

Override onConfigurationChanged


protected void onConfigurationChanged(Configuration newConfig) {
	super.onConfigurationChanged(newConfig);
	AGCrossSelling2.onConfigurationChanged(newConfig);
	// ....
}

Compatible with API_LEVEL >= 7

Download SDK for Android Google: AGCrossSelling2_4.5.1_google.zip