This guide provides solutions for common Android issues.
Missing Methods
If you are getting a NoSuchMethodError
when building your app, try the following:
- Within your project’s
build.gradle
file, update thecompileSdkVersion
to the latest Android API level. Verify that your Google Play Services dependencies are using matching versions. The following code, for example, would produce an error:
dependencies { compile 'com.android.support:support-v4:25.3.0' compile 'com.google.android.gms:play-services-gcm:10.0.0' // Does not match 10.0.0 above compile 'com.google.android.gms:play-services-location:10.0.1' }
Push
Not Receiving Push
If your app is not receiving push, please attempt each of the following:
- Verify push is really enabled on your app. On your device, go to Settings > Apps,
then click on your app and verify the
Show notifications
checkbox is checked. - Verify that user notifications are enabled.
- Use the Channels API to check your device’s opt-in status.
- If opted-in: Your GCM/FCM push provider key (located in the Go dashboard on the Settings > Services page) may be invalid. Please review the instructions here and verify you have configured GCM correctly.
- If opted-out: Your GCM Sender/Project ID may be invalid. Double check that your GCM sender ID and API keys are valid.
- Verify that your app configuration in your airship config contains the correct application key, application secret and gcmSender (required for GCM only).
- For Amazon apps, verify you have the correct
api_key.txt
file located in your project’sassets
folder. - Check your logcat for errors or warnings, which may provide valuable hints during debugging. The log level can be modified in the airship config options class.
- Verify your device’s network connection. Push notifications will not be delivered without a network connection. Unstable network connection may potentially prevent push notifications from arriving.
Duplicate Notifications
If your notifications are appearing twice on devices, you may be manually posting the
notification. Double check that you are not making a call to the NotificationManager
within an extended AirshipReciever
or NotificationFactory
class, e.g.:
public class CustomAirshipReceiver extends AirshipReceiver {
...
@Override
protected void onPushReceived(@NonNull Context context, @NonNull PushMessage message, boolean notificationPosted) {
Log.i(TAG, "Received push message. Alert: " + message.getAlert() + ". posted notification: " + notificationPosted);
// Rebuilds and posts a notification that has already been received/posted
Notification notification = new Notification.Builder(context)
.setContentTitle(message.getTitle())
.setContentText(message.getAlert())
.setSmallIcon(R.drawable.ic_notification)
.build();
NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
manager.notify(1234, notification);
}
...
}
The onPushReceived
method executes code after a push has already been received/posted. Rebuilding
the notification within that method will result in a duplicated message.
Analytics
Direct Opens not Counted
Disabled user notifications and duplicating messages results in the direct open count not incrementing.
These two issues combined mean you are only posting the manually created notification, while the notification sent via Urban Airship gets dropped. We only count notifications posted by Urban Airship, thus the direct open count is not incremented. To remedy this problem, you need to fix the two root causes by:
Android Knowledge Base
Please visit the Urban Airship Engage Knowledge Base for additional assistance.