**Download SDK **SDK API Docs
To integrate Pushwoosh push notifications into your android Adobe Air application you need to do simple following steps:
-
Grab PushNotifications.ane from https://github.com/Pushwoosh/pushwoosh-adobe-air/tree/master/ANE-Pushwoosh and add it to your project.
-
Add the following code to your application start routine:
//set push notification callbacks for the plugin var pushwoosh:PushNotification = PushNotification.getInstance(); pushwoosh.addEventListener(PushNotificationEvent.PERMISSION_GIVEN_WITH_TOKEN_EVENT, onToken); pushwoosh.addEventListener(PushNotificationEvent.PERMISSION_REFUSED_EVENT, onError); pushwoosh.addEventListener(PushNotificationEvent.PUSH_NOTIFICATION_RECEIVED_EVENT, onPushReceived); //Important! must call this functions after callbacks have been set. It will trigger all pending push notifications to be delivered. pushwoosh.onDeviceReady(); //register for push pushwoosh.registerForPushNotification();
The handler functions are straightforward:
public function onToken(e:PushNotificationEvent):void{ trace("\n TOKEN: " + e.token + " "); } public function onError(e:PushNotificationEvent):void{ trace("\n TOKEN: " + e.errorMessage+ " "); } public function onPushReceived(e:PushNotificationEvent):void{ trace("\n TOKEN: " + JSON.stringify(e.parameters) + " "); }
The last bit is to configure your app.xml, you should use the following snippet. Replace **PW_APPID** with your **Pushwoosh App ID**, and **PACKAGE_NAME** with your **Android package name**.
**3.** Get the API KEY from Amazon according to the Amazon guide: [https://developer.amazon.com/sdk/adm/credentials.html](https://developer.amazon.com/sdk/adm/credentials.html)
For a pre-release or “debug” version of your app, you must create an API Key and store it as the only data in a file named api_key.txt . **The api_key.txt file must be located inside the assets folder for your project.**
Note: ADM cannot recognize your API Key if it contains any spaces or line breaks.
For a release or “production” version of your app, you may not need to create an API Key. Only if you sign the release version of your app using your own certificate, must you create an additional API Key for the release version of your app. Otherwise, if you allow Amazon to sign your app on your behalf, you do not need to create an additional API Key.
You are almost there, the last step is to put “enable-feature” tag into your manifest.
The problem is that currently Adobe Air does not allow you to use amazon namespace, so *you need to unpack the APK with [APKTool](http://code.google.com/p/android-apktool/ "Android APKTool"), change the manifest and repack it back again.*
Please refer to the Amazon Developer forum thread on how to perform this operation.
Please note that for debug builds Adobe Air automatically postfixes your package name with “.debug”. We recommend to use “Release” builds to prevent a lot of headache.
That’s it!