Вопрос

How is it possible to place the logo of my app in the notification bar? I've seen many apps doing that.

For example this one on the left:

screenshot

Thanks.

Это было полезно?

Решение

Here they are

NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);


private void notification(String message){

    int icon = R.drawable.ic_launcher;
    CharSequence ticket = message;
    long when = System.currentTimeMillis();
    Notification notification = new Notification(icon, ticket, when);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    CharSequence contentTitle = "Buzz Off";
    CharSequence contentText = message;
    Intent intent = new Intent(this, HomeScreen.class);
    PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
    notification.setLatestEventInfo(this, contentTitle, contentText, activity);
    nm.notify(layout, notification);
    buzzOff = true;
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top