Android FAQs

General Questions

How large is the Android PushIO SDK?

PushIO Android SDK is currently 171KB. This size excludes the Android Support Library v4 and Google Play services library, which may add 1 to 2 MB if they are not in your project already.

MultiDex Support with PushIO SDK

Starting with PushIO SDK 6.31, a new class PIOApplication has been introduced for improving the detection of app life cycle events. This class is also required for proper handling of In-App Messages. If you have been using MultiDex in the past by extending the MultiDexApplication class, you will need to switch to one of the alternatives for Multidexing as explained in the Configure Apps with Over 64K Methods topic in the Android Studio User Guide.

About Firebase Cloud Messaging (FCM)

Google Cloud Messaging (GCM) has been rebranded to Firebase Cloud Messaging (FCM). Apps using PushIO SDK with GCM today should not experience any issues. However, Google strongly recommends that you import your GCM Google Cloud project to Firebase as soon as possible.

How do you retrieve the Device ID?

SDK puts several logs in the console when an app runs on a device using Android Studio. You can find the Device ID from the console log when an app runs on the device.

Sample Log:
2022-05-14 11:02:20.521 5822-5822/? I/pushio: PIORegM rWNS Your PushIO Device ID is: 0ada0df9-9a0f-43de-bcb3-b1d5b618bca2

To set the log level to verbose, see Debugging and Logging.

Also, an application calls the SDK API to get the Device ID and show it in the UI or any other format. Following are the APIs to access the Device ID:

PushIOManager.getInstance(getApplicationContext()).getDeviceId();

For more information, refer to Importing external device data.

Troubleshooting

AndroidX Compatibility

The Responsys Android SDK(Release 20A/Version 6.44 onwards), has migrated from Android support libraries to the Jetpack AndroidX libraries. Applications are required to migrate to AndroidX as well before using this version.

Additionally,applications using Responsys Android SDK(below Release version 20A/6.44) and have already migrated to AndroidX can use the PushIO SDK with Jetifier enabled in the gradle.properties file. Ensure you are using the latest Jetifier libraries(i.e greater than v1.0.0-beta04).

In the gradle.properties file add the following:

    android.useAndroidX=true
    android.enableJetifier=true

Kotlin Compatibility

The Responsys Android SDK (Release 19B / Version 6.41.0 onwards) is compatible with Android Apps written in the Kotlin Programming Language.

Capturing Log Files

  1. In Android Studio, select Android Monitor from the bottom of the window. (if you don't see this button, go to View > Tool Windows and select Android Monitor)
  2. Select your device from the drop down on the left of the window.
  3. Ensure no filters are set, search box has 'pushio' as text and the type is set to Verbose.
  4. Select the lines you would like to share (or all lines using Ctrl+A or Cmd+A) and paste in a text file to send over to the support team.

Notifications delayed / not shown

If you have read through the setup guides and still not able to receive push notifications:

  • Verify that the pushio_config.json file in your project’s assets folder contains the correct apiKey and projectId.

  • Verify that the device has a stable network connection. Push notifications will not be delivered without a network connection.

  • Verify that your AndroidManifest.xml file contains all the required permissions, services, activities, receivers, etc. for PushIO, GCM and/or ADM.

  • For Amazon apps, remember to capture the API key from Amazon's Developer Portal and add the api_key.txt file in your project’s assets folder. More info here.

At times the push notifications might get delivered after a delay, this could be due to the device being in a power-save mode. Some devices may enter into a power-saving or low power mode wherein the network communication is suspended at frequent time intervals causing the push notification delivery to be delayed.

No push notifications received after upgrading to SDK 6.31

If registration was successful but the device has not received push notifications:

  • Verify that your Google project has been correctly imported into Firebase. If you have not yet done that, you will need to migrate your GCM project from Google Cloud to Firebase as Firebase is the recommended platform for Cloud Messaging going forward.

  • Try changing the Server Key to the new format as generated by Firebase by doing the following:

    • In the Firebase console, select your project, click the Settings menu icon (the icon that resembles a gear), then choose 'Project Settings' and under 'Cloud Messaging' tab, you should see the new format Server Key along with the old Server Key.
    • Copy the new Server Key and add it to the PushIO/RI dashboard as shown in step [1.2] of our Step-by-Step guide.

If the above steps don't work, capture the logs from the device at the time of starting or launching your app, and share it with our support team.

Invalid Google Credentials

The Google Server API key is used for authenticating all communications with GCM/FCM. If you get this error:

  • Ensure that you enter the correct/updated Server Key in the PushIO dashboard or the Responsys Mobile App Developer Console.

  • Try generating a new Server key and check if that works. Following the introduction of Firebase Cloud Messaging (FCM), new Server keys are generated only at FCM portal.

Duplicate Notifications

Notifications are created by the PushIO SDK as a default behavior. However, you might want to change this to handle building/displaying the notifications yourself. If in doing so, you start seeing duplicate notifications, it is possible that the SDK is not aware of your notification handling.

To let the SDK know that you would be handling the notifications yourself, remember to set the following flag from your BroadcastReceiver:

public void onReceive(Context context, Intent intent) {

    CustomNotificationService.runIntentInService(context, intent);

    Bundle extras = getResultExtras(true);

    extras.putInt(PushIOManager.PUSH_STATUS, PushIOManager.PUSH_HANDLED_NOTIFICATION);

    setResultExtras(extras);

}

See section Optional - Customize Incoming Push Messages and Notification Taps, located near the bottom of the Step-by-Step guide topic for more information.