I know this is an old question, but UrbanAirship get's updated quite often, so I decided to help others who might reach this page. As of version 6.0.1 there's no BasicNotificationBuilder
no more. In order to customize your notification with icon and color and whatnot, you need to extend the NotifcationFactory
class, and override the createNotification
method.
Like shown in the example below:
public class MyNotificationFactory extends NotificationFactory {
public MyNotificationFactory(Context context){
super(context);
}
@Override
public Notification createNotification(PushMessage pushMessage, int i) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext())
.setContentTitle(getContext().getResources().getString(R.string.app_name))
.setContentText(pushMessage.getAlert())
.setSmallIcon(R.drawable.your_icon_here)
.setColor(getContext().getResources().getColor(R.color.your_color_here))
.setAutoCancel(true);
return builder.build();
}
@Override
public int getNextId(PushMessage pushMessage) {
return NotificationIDGenerator.nextID();
}
}
At last you must set this as UrbanAirship's new notification factory in your application class or wherever you initialized UA:
UAirship.shared().getPushManager().setNotificationFactory(new MyNotificationFactory(getApplicationContext()));