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);
}
});
}
}
Comments
2 comments