Acknowledgments
Prerequisites
ANE Package Content
Integration Instructions :
In your app's XML file , inside the Android tag you will find the Android Additions. Add the following code before the </manifest> tag :
... <permission android:name="air.DemoApp.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="air.DemoApp.permission.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <application> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <service android:name="com.appoxee.gcm.PlayIntentService" /> <!-- REQUIRED for C2DM --> <receiver android:name="com.appoxee.gcm.PlayBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <!-- Receive the actual message --> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="air.DemoApp" /> </intent-filter> <!-- Receive the registration id --> <intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="air.DemoApp" /> </intent-filter> </receiver> </application> |
In your app's main .as file , add the following code :
//Add this to imports : import com.appoxee.AppoxeeANE; ... //Add this to class : private var _appoxeeANE:AppoxeeANE; //Add the class's constructor : _appoxeeANE = new AppoxeeANE("YOUR_APPOXEE_APP_KEY","YOUR_APPOXEE_SECRET_KEY",handleIncomingPushMessage); ... //Add this method to get notified when push messages arrive to the device private function handleIncomingPushMessage(payload:String):void { trace("Handle Incoming Push Message Called with : "+result); //handle push payload in callback } |
The method handleIncomingPushMessage() id the method that will be called every time a push notification will be received by the device. Further explanation on using the Incoming Push Notification Callback Method can be found in Appoxee Adobe Air - Handling Extra Fields. |