I'm using Urban Airship push notification plugin in android. Everything working fine but in above Android 4.4 push notification icon is become white and not showing notification icon. This issue is only in Lolypop (>4.4). Any help is appreciated thanks.
Airship is the only App Experience Platform that can reliably deliver billions of push notifications in real-time from a centralized platform. That means you can easily set up coordinated multi-channel campaigns, and see all your customer engagement data in one place.
The app publisher composes a manual message through a message composer user interface. Alternatively, the publisher sets up an automated message to be sent via the API. The publisher defines the audience to whom the push notification will be sent.
A notification is a message you can display to the user outside of your application's normal UI. You can create your own notifications in android very easily. Notification notify = new Notification(android.
Airship's SDKs expose messaging and data-gathering functionality on your client devices, and our APIs support messaging mediums that can't use an SDK. Airship has SDKs for iOS, Android/Amazon, Windows, and Web platforms. The APIs correspond to Airship's engagement (messaging) and real-time event stream products.
It appears that apps that target SDK 21 (Lollipop) icons are automatically filtered to white - Notification bar icon turns white in Android 5 Lollipop. So to fix this, you can either set the target SDK version to 20, or you can manually modify the Urban Airship phonegap plugin and set the icon manually by replacing the execute method in https://github.com/urbanairship/phonegap-ua-push/blob/master/src/android/PushAutopilot.java with the following:
@Override
public void execute(final Application application) {
// Parse cordova config options
AirshipOptions configOptions = new AirshipOptions(application);
final boolean enablePushOnLaunch = configOptions.getBoolean(ENABLE_PUSH_ONLAUNCH, false);
UAirship.takeOff(application, getAirshipConfig(application, configOptions), new UAirship.OnReadyCallback() {
@Override
public void onAirshipReady(UAirship airship) {
// Create a new notification factory
DefaultNotificationFactory defaultNotificationFactory = new DefaultNotificationFactory(application);
// Customize the notification icon and accent color
defaultNotificationFactory.setSmallIconId(R.drawable.ic_notification);
defaultNotificationFactory.setColor(NotificationCompat.COLOR_DEFAULT);
// Set the factory
airship.getPushManager().setNotificationFactory(defaultNotificationFactory);
if (enablePushOnLaunch) {
airship.getPushManager().setUserNotificationsEnabled(true);
}
}
});
}
Replace the R.drawable_ic_notification
with an icon you included in your project.
Update: Released 3.0.0 of the plugin that allows you to specify the accent color and drawable name in the config without modifying any code.
<!-- Override the Android notification icon -->
<preference name="com.urbanairship.notification_icon" value="ic_notification" />
<!-- Specify the notification accent color for Android API 21+ (Lollipop) -->
<preference name="com.urbanairship.notification_accent_color" value="#0000ff" />
More info can be found here - https://github.com/urbanairship/phonegap-ua-push
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With