App icon appearing undersized

I have used the code shown below, in order to try and set an app icon that is correctly sized. This follows the guidelines as written elsewhere on the UA site.

However, it doesn't have any effect. Do I need to be adding the NotificationFacctory code somewhere else? In a custom class perhaps?
The image I've used is a black and white picture, also as described in the UA guidelines.

Any advice would be greatly appreciated,

Stuart.

 

import android.app.Application;
import android.util.Log;

import com.urbanairship.UAirship;
import com.urbanairship.push.notifications.DefaultNotificationFactory;

/**
* Created by Mr. Stuart Saunders on 29/11/2016.
*/

public class UAApplication extends Application {
@Override
public void onCreate() {
super.onCreate();



UAirship.takeOff(this, new UAirship.OnReadyCallback() {
@Override
public void onAirshipReady(UAirship airship) {
String channelId = UAirship.shared().getPushManager().getChannelId();
Log.v ("My Channel ID: " , channelId);

// Enable user notifications
//airship.getPushManager().setUserNotificationsEnabled(true);
UAirship.shared().getPushManager().setUserNotificationsEnabled(true);

// Create Notification Factory
DefaultNotificationFactory defaultNotificationFactory = new DefaultNotificationFactory(getApplicationContext());
// Get the Icon image from resources
defaultNotificationFactory.setSmallIconId(R.drawable.bwicon);
// Set the accent color
//defaultNotificationFactory.setColor(NotificationCompat.COLOR_DEFAULT);
airship.getPushManager().setNotificationFactory(defaultNotificationFactory);
}
});
}
}

Didn't find what you were looking for?

New post

Comments

2 comments

  • I actually solved this problem 5 minutes after posting the question.

    The image needs to be white only, with a transparent background.
    The UA methods then work some mysterious magic to make it appear in a notification and the top icon bar.

    It still appears somewhat smaller than I'd like, however, but I'll continue tinkering and see what can be done.

    0
  • Stu,

    If the icon is appearing smaller than what you would like, you may also set the Large Icon image by specifying:

    defaultNotificationFactory.setLargeIcon(<icon resource>);
    1

Please sign in to leave a comment.