-
-
Save adamdelarosa/0a2740b34c5c4e12a780a9671acecea7 to your computer and use it in GitHub Desktop.
Chartboost libGDX Implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AndroidLauncher extends AndroidApplication { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); | |
Chartboost.startWithAppId(this, “CHARTBOOST_APP_ID", “CHARTBOOST_APP_SIGNATURE"); | |
Chartboost.onCreate(this); | |
initialize(new YOUR_MAIN_CLASS(), config); | |
//usage is same with Android and IOS | |
//you can use methods after initialization with a location string CBLocation | |
//Chartboost.hasInterstitial(location) | |
//Chartboost.cacheInterstitial(location); | |
//Chartboost.showInterstitial(location); | |
//and more | |
} | |
@Override | |
public void onActivityResult(int request, int response, Intent data) { | |
super.onActivityResult(request, response, data); | |
} | |
@Override | |
public void onStart() { | |
super.onStart(); | |
Chartboost.onStart(this); | |
} | |
@Override | |
public void onStop() { | |
super.onStop(); | |
Chartboost.onStop(this); | |
} | |
@Override | |
public void onDestroy() { | |
super.onDestroy(); | |
Chartboost.onDestroy(this); | |
} | |
@Override | |
public void onResume() { | |
super.onResume(); | |
Chartboost.onResume(this); | |
} | |
@Override | |
public void onPause() { | |
super.onPause(); | |
Chartboost.onPause(this); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IOSLauncher extends IOSApplication.Delegate { | |
@Override | |
protected IOSApplication createApplication() { | |
IOSApplicationConfiguration config = new IOSApplicationConfiguration(); | |
config.orientationLandscape = false; | |
config.orientationPortrait = true; | |
return new IOSApplication(new YOUR_MAIN_CLASS() config); | |
} | |
@Override | |
public void didReceiveMemoryWarning(UIApplication application) { | |
super.didReceiveMemoryWarning(application); | |
} | |
@Override | |
public void didBecomeActive(UIApplication application) { | |
super.didBecomeActive(application); | |
} | |
@Override | |
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) { | |
System.out.println("IOSLauncher: Finished Launching.”); | |
//you can implement ChartboostDelegate to listen chartboost related events, didn’t added to keep it simple | |
Chartboost.start(“CHARTBOOST_APP_ID", “CHARTBOOST_APP_SECRET", new ChartboostDelegateAdapter()); | |
//usage is same with Android and IOS | |
//you can use methods after initialization with a location string CBLocation | |
//Chartboost.hasInterstitial(location) | |
//Chartboost.cacheInterstitial(location); | |
//Chartboost.showInterstitial(location); | |
//and more | |
return super.didFinishLaunching(application, launchOptions); | |
} | |
public static void main(String[] argv) { | |
NSAutoreleasePool pool = new NSAutoreleasePool(); | |
UIApplication.main(argv, null, IOSLauncher.class); | |
pool.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment