create Default Notification - Android Android OS

Android examples for Android OS:Notification Create

Description

create Default Notification

Demo Code


//package com.java2s;
import android.app.Notification;

public class Main {
    private static int icon = 0;
    private static CharSequence tickerText = "Capsule";

    public static Notification createDefaultNotification() {
        long when = System.currentTimeMillis();
        Notification notification = new Notification(icon, tickerText, when);

        notification.defaults |= Notification.DEFAULT_SOUND;
        notification.defaults |= Notification.DEFAULT_VIBRATE;
        notification.defaults |= Notification.DEFAULT_LIGHTS;

        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        return notification;
    }//from   w w  w . ja  v  a2 s. com
}

Related Tutorials