Batch Air Native Extension (ANE) is compatible with both iOS 6+ and Android 2.3+. It supports AIR 4.0+ and Flex SDK 4.12 or higher is required. You can download the latest version at the Apache Website.
Batch requires only one permission: Internet access, so you need to be sure you have it in your android manifest (in the app.xml xml available into the src directory of your app) otherwise Batch will not start correctly on Android.
<uses-permission android:name="android.permission.INTERNET" />
Download the ANE and integrate it into your AIR app: Add ANE into your app.
You now are ready to implement the main functions of Batch into your app. The start function requires a configuration containing your API keys, so a typical implementation will be:
<?xml version="1.0" encoding="utf-8"?> <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.FirstView" applicationDPI="160"> <fx:Declarations> </fx:Declarations> <fx:Script> <![CDATA[ import com.batch.ane.Batch; import com.batch.ane.Config; // Build config var config:Config = new Config().setAndroidAPIKey("YOUR_ANDROID_API_KEY").setiOSAPIKey("YOUR_IOS_API_KEY"); // Call batch start with the config Batch.start(config); ]]> </fx:Script> </s:ViewNavigatorApplication>
YOUR_API_KEY is your Batch Dev or Live API key. You'll find the API keys needed to set up the SDK in ⚙ Settings → General:
Batch iOS API key must not be mistaken for the APNS environment Batch will output to the Xcode logs when starting. The environment depends on the app's provision, not on the Batch API Key used.
Batch ANE will automaticaly bind itself on the app lifecycle events (
EVENT.DEACTIVATE), you do not need to implement it yourself.
Congratulations on finishing the bulk of the integration!
If you want to validate your implementation before proceeding with the Push setup, you can locate the log that Batch posts in your app log in devmode.
Here is how it should look after a correct integration:
Batch: Batch is running in dev mode (your API key is a dev one)
[Batch] Batch started with a DEV API key