Adobe AIR

How to integrate Pushwoosh SDK into your Adobe AIR project

Supports iOS, Android

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 distriqt libraries to your project:

com.distriqt.playservices.Base.ane

Download Google Play Services library

com.distriqt.androidsupport.AppCompatV7
com.distriqt.androidsupport.Design
com.distriqt.androidsupport.RecyclerViewV7
com.distriqt.androidsupport.V4

Download Android Support libraries

com.distriqt.Firebase

Download Firebase library

3. Configure your project in Firebase Console.

4. Locate the google-services.json file to the root level of your project.

google-services.json

You should've gotten the google-services.json file while creating the app in Firebase console. If you haven't, please consult this thread.

5. 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) + " ");
}

6. 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:

iOS + Android
<iPhone>
<InfoAdditions>
<![CDATA[
<key>Pushwoosh_APPID</key>
<string>PUSHWOOSH_APP_ID</string>
]]>
</InfoAdditions>
<Entitlements>
<![CDATA[
<key>aps-environment</key>
<string>development</string>
]]>
</Entitlements>
<requestedDisplayResolution>high</requestedDisplayResolution>
</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_icon" android:value="@drawable/notification_small_icon" />
<meta-data android:name="com.pushwoosh.notification_service_extension" android:value="com.pushwoosh.nativeExtensions.PushwooshNotificationServiceExtension"/>
<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:name="com.pushwoosh.BootReceiver"
android:enabled="true"
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>
<service
android:name="com.google.firebase.components.ComponentDiscoveryService"
android:exported="false" >
<meta-data
android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
</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:name="com.pushwoosh.internal.utils.LockScreenService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:enabled="true"
android:exported="false" />
<provider
android:name="com.pushwoosh.PushwooshInitProvider"
android:authorities="PACKAGE_NAME.pushwooshinitprovider"
android:enabled="true"
android:exported="false"
android:initOrder="50" />
<provider
android:name="com.pushwoosh.nativeExtensions.PushwooshFirebaseInitProvider"
android:authorities="PACKAGE_NAME.FirebaseInitProvider"
android:enabled="true"
android:exported="false"
android:initOrder="60" />
<provider
android:name="com.pushwoosh.PushwooshSharedDataProvider"
android:authorities="PACKAGE_NAME.PushwooshSharedDataProvider"
android:enabled="true"
android:exported="true"
android:initOrder="60"
/>
<service
android:name="com.pushwoosh.PushwooshService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
android:name="com.pushwoosh.NotificationOpenReceiver"
android:enabled="true"
android:exported="false" />
<meta-data
android:name="com.pushwoosh.plugin.badge"
android:value="com.pushwoosh.badge.BadgePlugin" />
<!-- firebase-iid START -->
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" 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>
<!-- FirebaseInstanceIdService performs security checks at runtime,
no need for explicit permissions despite exported="true" -->
<service android:name="com.google.firebase.iid.FirebaseInstanceIdService" android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<!-- firebase-iid END -->
<!-- work-runtime START -->
<service
android:name="androidx.work.impl.background.systemalarm.SystemAlarmService"
android:directBootAware="false"
android:enabled="@bool/enable_system_alarm_service_default"
android:exported="false" />
<service
android:name="androidx.work.impl.background.systemjob.SystemJobService"
android:directBootAware="false"
android:enabled="@bool/enable_system_job_service_default"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
android:name="androidx.work.impl.utils.ForceStopRunnable$BroadcastReceiver"
android:directBootAware="false"
android:enabled="true"
android:exported="false" />
<receiver
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryChargingProxy"
android:directBootAware="false"
android:enabled="false"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
<receiver
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryNotLowProxy"
android:directBootAware="false"
android:enabled="false"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BATTERY_OKAY" />
<action android:name="android.intent.action.BATTERY_LOW" />
</intent-filter>
</receiver>
<receiver
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$StorageNotLowProxy"
android:directBootAware="false"
android:enabled="false"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.DEVICE_STORAGE_LOW" />
<action android:name="android.intent.action.DEVICE_STORAGE_OK" />
</intent-filter>
</receiver>
<receiver
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy"
android:directBootAware="false"
android:enabled="false"
android:exported="false" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<receiver
android:name="androidx.work.impl.background.systemalarm.RescheduleReceiver"
android:directBootAware="false"
android:enabled="false"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.TIME_SET" />
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
</receiver>
<receiver
android:name="androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver"
android:directBootAware="false"
android:enabled="@bool/enable_system_alarm_service_default"
android:exported="false" >
<intent-filter>
<action android:name="androidx.work.impl.background.systemalarm.UpdateProxies" />
</intent-filter>
</receiver>
<!-- work-runtimme END -->
<meta-data
android:name="com.pushwoosh.plugin.inbox"
android:value="com.pushwoosh.inbox.PushwooshInboxPlugin" />
<activity
android:name="com.pushwoosh.nativeExtensions.AirInboxActivity" />
</application>
<!-- 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" />
<!-- Vibration in push notification -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--BADGES-->
<!--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"/>
</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.

6. 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:

Geozones Push Notifications

  1. To enable location tracking in your application: 1.1 Grab PushwooshGeozones.ane and add it to your project.

    1.2. Add distriqt libraries to your project:

com.distriqt.playservices.Location

Download library

1.3. Add the following strings to InfoAdditions:

app.xml
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string> NSLocationAlwaysAndWhenInUseUsageDescription </string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>NSLocationWhenInUseUsageDescription </string>
<key>NSLocationAlwaysUsageDescription</key>
<string>NSLocationAlwaysUsageDescription</string>

where:

  • NSLocationWhenInUseUsageDescription(required) for app to track Geozones only while running in the foreground.

  • NSLocationAlwaysAndWhenInUseUsageDescription - (required) for app to track Geozones in both conditions, and to show a permission request dialog pop-up.

  • NSLocationAlwaysUsageDescription(optional) for app to track Geozones at all times; should be used if your app targets iOS 10 and earlier versions.

1.4. Add the following strings to manifestAdditions after the <application> string:

app.xml
<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" />
<service android:name="com.pushwoosh.location.foregroundservice.ForegroundService"/>
<receiver android:name="com.pushwoosh.location.geofencer.GeofenceReceiver">
<intent-filter>
<action android:name="PACKAGE_NAME.action.PROCESS_UPDATES" />
</intent-filter>
</receiver>

Add the following code to manifestAdditions after the </application> string:

app.xml
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

2. To start location tracking, call:

import com.pushwoosh.geozones.nativeExtensions.*;
PushwooshGeozones.getInstance().startLocationTracking();

That’s it!