Using the AppBrain SDK in Adobe AIR
To use the AppBrain SDK from an Adobe AIR app you can use our Adobe AIR native extension. This ANE-file is used in your project instead of the usual AppBrain JAR.
Setting up your app
Contact us at contact@appbrain.com to get the AppBrain AIR native extension (ANE) file.
Add the file
appbrain-sdk.ane
to your project (see Adobe documentation).
In your Adobe AIR Application Descriptor File, find the <android>
tag and make sure the following two permissions are enabled inside the <manifest>
tag:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Then add the necessary AppBrain tags. These need to be inside the <application>
tag, so if the <application>
tag isn’t present yet, add it:
<application
android:enabled="true"
android:debuggable="true" >
<!-- AppBrain SDK -->
<activity
android:name="com.appbrain.AppBrainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<service android:name="com.appbrain.AppBrainService" />
<service
android:name="com.appbrain.AppBrainJobService"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
Calling AppBrain functions
Now you can call AppBrain methods from your ActionScript code. Make sure to call init()
the moment your application starts:
var appBrain:AppBrainExtension = new AppBrainExtension();
appBrain.init();
It is recommended to show the interstitial when your app exits. You can do this by calling:
appBrain.maybeShowInterstitial();
Note that the AppBrain AIR extension is currently in beta stage and other features may still be missing.