Android Accengage migration

Migration from Accengage SDK to Airship SDK.

This guide will help you migrate from the Accengage platform to the Airship platform by installing the Airship-Accengage module. This module allows you to continue sending messages to your entire audience (upgraded, non-upgraded, net new users) through the Accengage platform while upgrading users to the Airship platform. After all or most of your users have updated to the latest version of your app, you can use the Airship platform exclusively for your messaging and remove the Airship-Accengage module.

For more information about the migration, please visit our documentation about Accengage Upgrade.

Setup Instructions

  1. Remove A4SSDK and Firebase dependencies as well as any additional Accengage methods from your build.gradle file.

    build.gradle
    dependencies {
        // ...
        compile 'com.ad4screen.sdk:A4SSDK:3.6.5'
        compile 'com.ad4screen.sdk:plugin-firebase-messaging:2.3'
    }
    
  2. Remove Accengage credential keys from strings.xml (Partner ID, Private Key, Sender ID, etc.)

    strings.xml
    <resources>
        // ...
    
        <string name="acc_partner_id">YOUR_PARTNER_ID</string>
        <string name="acc_private_key">YOUR_PRIVATE_KEY</string>
    
        <string name="acc_sender_id">gcm:your_sender_id</string>
        <string name="acc_no_geoloc">true</string>
    </resource>
    
  3. Remove Accengage Broadcast Receivers in your AndroidManifest.xml.

  4. Install the Airship SDK.

  5. Add the Airship-Accengage module to your build.gradle.

    build.gradle
        // Airship - Accengage
        implementation "com.urbanairship.android:urbanairship-accengage:$airshipVersion"
        

  6. Start the Airship SDK.

  7. You may keep the Accengage UpdateDeviceInformation method calls, as they will still work in the Airship SDK.

     Note

    The increment/decrement methods are not supported in the Airship SDK.

    Accengage method calls can also be replaced with Airship method calls, if needed. See the documentation on attributes for more details.

  8. Remove the remaining Accengage features and replace them with the corresponding Airship features. For more details, check the sections below.

Allow URLs

In Airship, all URLs are not verified by default. Applications that use open URL action, landing pages, deeplinks and custom in-app message image URLs will need to provide a list of URL patterns that match those URLs for SCOPE_OPEN_URL. It is possible to allow all URLs by adding urlAllowListScopeOpenURL = * to the AirshipConfig. See the URL Allow List documentation for more information.

Push Notifications

If you need more advanced uses of Push Notifications, like customization, or channels, see Push Notifications.

Enabling Push Notifications

To enable Push Notifications, make sure that the correct module is installed. For example if you’re using FCM, check that the urbanairship-fcm module is installed:

build.gradle
// Airship - FCM
implementation "com.urbanairship.android:urbanairship-fcm:$airshipVersion"

During the migration, the Opt-in status of your users are automatically transferred to Airship. But if needed, you can still ask for Push notification consent, and then call the following method to enable or disable notifications:

Enable/Disable user notifications
//Enable notifications
UAirship.shared().getPushManager().setUserNotificationsEnabled(true);
//Disable notifications
UAirship.shared().getPushManager().setUserNotificationsEnabled(false);
//Enable notifications
UAirship.shared().pushManager.userNotificationsEnabled = true
//Disable notifications
UAirship.shared().pushManager.userNotificationsEnabled = false

See Send Your First Message or our API reference for details on sending the first notification.

SplashScreen & Push Lock

If your app is using a Splashscreen and you had to “lock” the Push, this method call is no longer needed, so you can remove them.

Push Notification Icon

To be able to set a notification icon on your Accengage pushes, add a custom parameter with the key a4ssmalliconname with your icon name as the value. Your icon needs to be in your app’s drawable resources. Make sure that your icon is a white and transparent flat icon, to follow Google Guidelines.

Deep Linking

The default deep link action assumes that the application is set up to handle deep links through Android implicit intents. Implicit intents are intents used to launch components by specifying an action, category, and data instead of providing the component’s class. This allows any application to invoke another application’s component to perform an action. Only application components that are configured to receive the intent, by specifying an intent filter, will be considered. So you can keep them if you already set deep links in your AndroidManifest, like this:

Accengage strings.xml
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <!-- we are declaring schema testapp://p1 for this activity -->
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="testapp" android:host="p1" />
        </intent-filter>
    </activity>
    <activity
        android:name="SecondActivity">
        <!— This activity is launched by scheme url testapp://p2 -->
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="testapp" android:host="p2" />
        </intent-filter>
    </activity>
</application>

These deep links will still be handled by the Airship SDK, but you can also customize how deep links are handled by setting a DeepLinkListener on the UAirship instance during takeOff.

Example DeepLinkListener
@Override
public void onAirshipReady(@NonNull UAirship airship) {
   airship.setDeepLinkListener(deepLink -> {
      // Handle the deepLink
      return true;
   });
}
fun onAirshipReady(airship: UAirship) {
   airship.setDeepLinkListener(DeepLinkListener { deepLink: String? -> true })
}

Data collection (GDPR compliancy)

Data collection can be disabled at the SDK level to prevent the collection of any non-essential, personally identifiable data.

The Accengage SDK has a Data Opt-In setting in strings.xml to specify if you want to use Opt-In methods (“acc_optin_data”) so you can fully disable the data collection from the SDK. This setting is replaced in Airship with this one :

  # Require explicit opt-in to data collection
  dataCollectionOptInEnabled = true

If this property is enabled, you can then use the Data Collection methods to enable (or disable) data collection when your user agrees to it. For reference, these were the calls used in the Accengage SDK:

A4S.get(mContext).setOptinData(mContext, OptinType.YES);
A4S.get(mContext).setOptinData(mContext, OptinType.NO);
A4S.get(mContext).setOptinData(mContext, OptinType.YES);
A4S.get(mContext).setOptinData(mContext, OptinType.NO);

Now, you can replace them with the following calls:

UAirship.shared().setDataCollectionEnabled(true);
UAirship.shared().setDataCollectionEnabled(false);
UAirship.shared().isDataCollectionEnabled = true
UAirship.shared().isDataCollectionEnabled = false

Note that in Accengage SDK, setting the OptinType at “NO” fully disable the SDK. In Airship, the SDK is still enabled, but with limited features.

Disabling data collection disables the following Airship features:

  • Push tokens
  • Channels
  • Analytics events
  • Location
  • Attributes
  • Associated Identifiers
  • Tags
  • Named user

Remaining functionality (when data collection is disabled) includes broadcast Message Center messages and broadcast In-App Automation messages.

Data collected in the SDK

 Note

The data collected in the SDK is not used to track users across apps.

Data collection enabled (default)

The following data is sent to Airship when data collection is enabled.

Data collected by SDK
  • Platform
  • Package name
  • Registered Notification Types
  • Time in app
  • SDK Version
  • App Version
  • Device model
  • Device manufacturer
  • Push provider
  • OS version
  • Carrier
  • Locale
  • Timezone
  • Airship Channel ID
  • Connection type
  • Device Token/Push Registration Token
  • Airship Framework usage (Cordova, Titanium, ReactNative, Xamarin, Flutter, Unity plugins)
  • Message Center User ID (generated when including the Message Center module)
  • Notification open events
  • Send events
  • In-App Message events
  • Message Center Reads
  • Message Center Deletes
  • Location updates
Data set by App
  • Screen tracking
  • Associated Identifiers
  • Attributes
  • Tags
  • Named User ID
  • Custom events
  • Quiet Time
  • Push opt-in and notification opt-in status

Data collection disabled

The following data is sent to Airship when data collection is disabled.

Data collected by SDK
  • Platform
  • Package name
  • Device model
  • Device manufacturer
  • Push provider
  • SDK version
  • Locale
  • Timezone
  • Airship Channel ID
  • Message Center User ID (generated when including the Message Center module)
  • Device Token/Push Registration Token (only when explicitly enabled by app)
  • Send events
  • Message Center Reads
  • Message Center Deletes
Data set by App
  • Quiet Time
  • Push opt-in and notification opt-in status

For more details about the data collected, check the Data Collection docs

Attributes

Attributes can be set on ChannelsAn instance representing an entity addressable via the Airship service, e.g., an iOS device, email address, SMS number or web browser. The channel instance or channel object contains all relevant information about a channel, including metadata used for targeting, opt-in status, device-specific information, and, importantly, a unique identifier for the channel, the channel ID. and Named UsersA customer-provided identifier used for mapping multiple devices and channels to a specific individual. . See the attributes documentation for more information.

Update Device Information

Formerly called Update Device Information in the Accengage SDK, this feature is called Attributes in the Airship SDK.

If you have this feature implemented in your application, you can keep the Accengage updateDeviceInformation calls. The Airship SDK will transform them into Airship attributes feature calls.

But if you want to use the Airship Attributes feature directly, you’ll need to replace this code:

Accengage SDK
DeviceInformation info = new DeviceInformation();
info.set("Firstname", "John");
info.set("Lastname", "Doe");
info.set("Age", 35);
info.set("Date", new Date());
A4S.get(getApplicationContext()).updateDeviceInformation(info);
val info = DeviceInformation()
info["Firstname"] = "John"
info["Lastname"] = "Doe"
info["Age"] = 35
info["Date"] = Date()
A4S.get(applicationContext).updateDeviceInformation(info)

with this one:

Airship SDK
UAirship.shared().getChannel().editAttributes()
        .setAttribute("Firstname", "John")
        .setAttribute("Lastname", "Doe")
        .setAttribute("Age", 35)
        .setAttribute("Date", new Date())
        .apply();
UAirship.shared().channel.editAttributes()
        .setAttribute("Firstname", "John")
        .setAttribute("Lastname", "Doe")
        .setAttribute("Age", 35)
        .setAttribute("Date", Date())
        .apply()

Events

Views

Formerly called View tracking on Accengage, this feature is called Screen tracking in the Airship SDK.

If you have this feature implemented in your application, you’ll need to replace this code:

Accengage SDK
A4S.get(mContext).setView("your_view");
A4S.get(mContext).setView("your_view");

with this code in your Activity.onStart or Fragment.onStart:

Airship SDK
UAirship.shared().getAnalytics().trackScreen("your_view");
UAirship.shared().analytics.trackScreen("your_view")

On Accengage, every Activity was automatically tracked with their name. If you want to have the same behavior on Airship, you’ll need to implement an activity life cycle listener:

Airship SDK
this.registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
    @Override
    public void onActivityStarted(Activity activity) {
        UAirship.shared().getAnalytics().trackScreen(activity.getClass().getSimpleName());
    }
});
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
  override fun onActivityStarted(activity: Activity) {
      UAirship.shared().analytics.trackScreen(activity.javaClass.simpleName)
  }
})

Custom Events

If you have some Accengage Custom Events implemented in your application, you’ll need to use Airship’s Custom Events instead. For that, you just have to replace this code:

Accengage SDK
JSONObject eventValue = new JSONObject();
eventValue.put("string-type-field", "value");
eventValue.put("bool-type-field", true);
eventValue.put("number-type-field", 7201);
eventValue.put("date-type-field", (myDate.getTime() / 1000L));
A4S.get(mContext).trackEvent(1001, eventValue.toString());
val eventValue = JSONObject()
eventValue.put("string-type-field", "value")
eventValue.put("bool-type-field", true)
eventValue.put("number-type-field", 7201)
eventValue.put("date-type-field", myDate.time / 1000L)
A4S.get(applicationContext).trackEvent(1001, eventValue.toString())

with this code:

Airship SDK
// Create the event
CustomEvent event = CustomEvent.newBuilder("your_event_name")
                                .addProperty("string-type-field", "value")
                                .addProperty("bool-type-field", true)
                                .addProperty("number-type-field", 7201)
                                .addProperty("date-type-field", (myDate.getTime() / 1000L))
                                .build();

// Record it
event.track();
// Create the event
val event = CustomEvent.newBuilder("your_event_name")
                       .addProperty("string-type-field", "value")
                       .addProperty("bool-type-field", true)
                       .addProperty("number-type-field", 7201)
                       .addProperty("date-type-field", (myDate.getTime() / 1000L))
                       .build()

// Record it
event.track()
 Note

Airship uses strings for tracking custom events instead of integers. When creating custom events in Airship, use the name field where you would normally use the event ID in Accengage.

Accengage Predefined Events

If you are using Lead, Cart or Purchase Events, you’ll have to use Airship’s Custom Events to track the data you need to.