Adobe AIR

How to integrate Pushwoosh SDK into your Adobe AIR project

Supports iOS, Android, Amazon

The plugin needs AIR SDK version 26.0 or above.

Download SDK
Sample Project
SDK API Docs

To integrate Pushwoosh push notifications into your Adobe Air application follow these simple steps:

  1. Grab PushNotifications.ane and add it to your project.

  2. 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! Call this function when callbacks have been set. It triggers delivery of all pending push notifications.
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) + " ");
}
  1. Now configure your app.xml. Replace PUSHWOOSH_APP_ID with your actual Pushwoosh App ID. For Android replace GOOGLE_PROJECT_NUMBER with your Google Project Number and PACKAGE_NAME with your Android package name:
<iPhone>
    <InfoAdditions>
        <![CDATA[
            <key>Pushwoosh_APPID</key>
            <string>PUSHWOOSH_APP_ID</string>
        ]]>
    </InfoAdditions>
    <Entitlements>
        <![CDATA[
            <key>aps-environment</key>
            <string>development</string>
        ]]>
    </Entitlements>  
</iPhone>
<android>
    <manifestAdditions><![CDATA[
            <manifest android:installLocation="auto">

            <application>
           		<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

							<meta-data android:name="com.pushwoosh.appid" android:value="PUSHWOOSH_APP_ID" />
							<meta-data android:name="com.pushwoosh.senderid" android:value="AGOOGLE_SENDER_ID" />
							<meta-data android:name="com.pushwoosh.foreground_push" android:value="true" />

							<meta-data android:name="com.pushwoosh.notification_service_extension"
android:value="com.pushwoosh.nativeExtensions.PushwooshNotificationServiceExtension" />
            <!-- CORE -->
	            <activity

android:name="com.pushwoosh.inapp.view.RichMediaWebActivity"
          android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <activity
            android:name="com.pushwoosh.inapp.view.RemoteUrlActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <service
            android:name="com.pushwoosh.inapp.InAppRetrieverService"
            android:permission="android.permission.BIND_JOB_SERVICE" />

            <receiver
            android:enabled="true"
            android:name="com.pushwoosh.BootReceiver"
            android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
            <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />

            <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            </receiver>

            <service android:name="com.pushwoosh.FcmRegistrationService">
            <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
            </service>

            <service android:name="com.pushwoosh.PushFcmIntentService">
            <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
            </service>

            <activity
            android:name="com.pushwoosh.internal.utils.PermissionActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <receiver android:name="com.pushwoosh.notification.LocalNotificationReceiver" />

            <service
            android:enabled="true"
            android:exported="false"
            android:name="com.pushwoosh.internal.utils.LockScreenService"
            android:permission="android.permission.BIND_JOB_SERVICE" />

            <service
            android:exported="false"
            android:name="com.pushwoosh.PushwooshService"
            android:permission="android.permission.BIND_JOB_SERVICE" />

            <receiver
            android:enabled="true"
            android:exported="false"
            android:name="com.pushwoosh.NotificationOpenReceiver" />

            <provider
            android:authorities="PACKAGE_NAME.pushwooshinitprovider"
            android:enabled="true"
            android:exported="false"
            android:initOrder="50"
            android:name="com.pushwoosh.PushwooshInitProvider" />

            <!-- BADGE -->
            <meta-data
            android:name="com.pushwoosh.plugin.badge"
            android:value="com.pushwoosh.badge.BadgePlugin" />

            <!-- BEACON -->
            <!-- <service
            android:name="com.pushwoosh.thirdparty.radiusnetworks.ibeacon.service.IBeaconService"
            android:enabled="true"
            android:exported="true"
            android:isolatedProcess="false"
            android:label="iBeacon" />
            <service
            android:name="com.pushwoosh.thirdparty.radiusnetworks.ibeacon.IBeaconIntentProcessor"
            android:enabled="true" />
            <service android:name="com.pushwoosh.beacon.PushBeaconService" /> -->

            <!-- GCM -->
            <!-- uses applicationId -->
            <receiver
            android:exported="true"
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />

            <category android:name="PACKAGE_NAME" />
            </intent-filter>
            </receiver>

            <!-- uses applicationId end -->
            <service
            android:exported="false"
            android:name="com.pushwoosh.GcmRegistrationService">
            <intent-filter android:priority="-50">
            <action android:name="com.google.android.gms.iid.InstanceID" />
            </intent-filter>
            </service>

            <service
            android:exported="false"
            android:name="com.pushwoosh.PushGcmIntentService">
            <intent-filter android:priority="-50">
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
            </service>

            <!-- it must have initOrder higher than AmazonInitProvider-->
            <!-- uses applicationId -->
            <provider
            android:authorities="PACKAGE_NAME.gcmpushwooshinitprovider"
            android:enabled="true"
            android:exported="false"
            android:initOrder="53"
            android:name="com.pushwoosh.gcm.GcmInitProvider" />
            <!-- uses applicationId end -->
            
            <meta-data
			android:name="com.pushwoosh.plugin.location"
			android:value="com.pushwoosh.location.LocationPlugin" />

		<service android:name="com.pushwoosh.location.network.GeoLocationServiceApi16" />

		<activity
			android:name="com.pushwoosh.location.internal.utils.ResolutionActivity"
			android:theme="@android:style/Theme.Translucent.NoTitleBar" />

		<service
			android:name="com.pushwoosh.location.network.GeoLocationServiceApi21"
			android:exported="true"
			android:permission="android.permission.BIND_JOB_SERVICE" />

		<!-- uses applicationId -->
		<receiver android:name="com.pushwoosh.location.geofencer.GeofenceReceiver">
			<intent-filter>
				<action android:name="PACKAGE_NAME.action.GEOFENCE" />
			</intent-filter>
		</receiver>
      
            </application>

            <!-- CORE -->

            <!-- Keeps the processor from sleeping when a message is received. -->
            <uses-permission android:name="android.permission.WAKE_LOCK" />

            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

            <!-- FCM connects to Firebase Services. -->
            <uses-permission android:name="android.permission.INTERNET" />

            <!-- This app has permission to register and receive data message. -->
            <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
                  
            <!-- BADGE -->
            <!--for Samsung-->
            <uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
            <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />

            <!--for htc-->
            <uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
            <uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />

            <!--for sony-->
            <uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />
            <uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE" />

            <!--for apex-->
            <uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />

            <!--for solid-->
            <uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE" />

            <!--for huawei-->
            <uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
            <uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
            <uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />

            <!--for ZUK-->
            <uses-permission android:name="android.permission.READ_APP_BADGE" />

            <!--for OPPO-->
            <uses-permission android:name="com.oppo.launcher.permission.READ_SETTINGS" />
            <uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS" />

            <!--for EvMe-->
            <uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ" />
            <uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE" />

            <!-- BEACON -->

            <!-- <uses-permission android:name="android.permission.BLUETOOTH" />
            <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> -->

            <!-- GCM -->
            <!-- uses applicationId -->
            <permission
            android:name="PACKAGE_NAME.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />

            <uses-permission android:name="PACKAGE_NAME.permission.C2D_MESSAGE" />
            <!-- uses applicationId end -->
            
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

	<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
            

            <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
            </manifest>
        ]]></manifestAdditions>
    <colorDepth>16bit</colorDepth>
</android>
<android>
    <manifestAdditions><![CDATA[
        <manifest android:installLocation="auto">
            <application>
                <meta-data android:name="PW_APPID" android:value="PUSHWOOSH_APP_ID" />
                <meta-data android:name="PW_BROADCAST_PUSH" android:value="true" />
             
                <receiver
                        android:name="com.pushwoosh.MessageAlertReceiver"
                        android:permission="com.amazon.device.messaging.permission.SEND">
                    <intent-filter>
                        <action android:name="com.amazon.device.messaging.intent.RECEIVE"/>
                        <action android:name="com.amazon.device.messaging.intent.REGISTRATION"/>
                        <category android:name="PACKAGE_NAME"/>
                    </intent-filter>
                </receiver>

                <amazon:enable-feature android:name="com.amazon.device.messaging" android:required="false" />

                <receiver android:name="com.pushwoosh.local.AlarmReceiver" />
                <receiver android:name="com.pushwoosh.local.BootReceiver"
                          android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
                          android:enabled="true">
                    <intent-filter>
                        <action android:name="android.intent.action.BOOT_COMPLETED" />
                        <category android:name="android.intent.category.DEFAULT" />
                    </intent-filter>
                </receiver>

                <activity android:name="com.pushwoosh.richpages.RichPageActivity" />
                <activity android:name="com.pushwoosh.MessageActivity" />
                <activity android:name="com.pushwoosh.PushHandlerActivity" />
                <activity android:name="com.pushwoosh.nativeExtensions.PushActivity">
                    <intent-filter>
                        <action android:name="PACKAGE_NAME.MESSAGE"/>
                        <category android:name="android.intent.category.DEFAULT"/>
                    </intent-filter>
                </activity>
                     
                <service android:name="com.pushwoosh.PushAmazonIntentService"/>
                <receiver android:name="com.pushwoosh.local.AlarmReceiver"></receiver>

            </application>
 
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
              
             <!-- ADM connects to Amazon Services. -->
             <uses-permission android:name="android.permission.INTERNET"/>
              
             <!-- Keeps the processor from sleeping when a message is received. -->
             <uses-permission android:name="android.permission.WAKE_LOCK"/>
              
             <!--
              Creates a custom permission so only this app can receive its messages.
              
              NOTE: the permission *must* be called PACKAGE.permission.RECEIVE_ADM_MESSAGE,
                    where PACKAGE is the application's package name.
             -->
             <permission
                     android:name="PACKAGE_NAME.permission.RECEIVE_ADM_MESSAGE"
                     android:protectionLevel="signature"/>
             <uses-permission
                     android:name="PACKAGE_NAME.permission.RECEIVE_ADM_MESSAGE"/>
              
             <!-- This app has permission to register and receive data message. -->
             <uses-permission
                     android:name="com.amazon.device.messaging.permission.RECEIVE"/>
              
             <!-- ADM requires Android SDK version 2.2 (API level 8 ) or above. -->
             <!-- The targetSdkVersion is optional, but it's always a good practice
                  to target higher versions. -->
             <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
                                 
        </manifest>
             
        ]]>
    </manifestAdditions>
    <colorDepth>16bit</colorDepth>
</android>

iOS Important Info

Please note that for development builds ( ones signed with iOS Development Certificates) the value for aps-environment should be development as in the example above. For Ad-Hoc or AppStore builds (ones signed with iOS Production Certificate) please use production value.

Android Important Info

IMPORTANT! Sender id is an integer but prefix it with "A" as in the example above. Ex: "A1234567890".

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.

Amazon API Key

Get the API KEY from Amazon according to the Amazon guide.
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. Create an additional API key nly 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. You don't need an extra API key if you let Amazon sign the app on your behalf.

  1. Make sure you select “Package” checkbox on the “Native Extensions” pane in the settings. Also select the path to the latest iOS SDK as per screenshot below when exporting for iOS:

That’s it!

Adobe AIR

How to integrate Pushwoosh SDK into your Adobe AIR project