Example usage for android.app Notification DEFAULT_VIBRATE

List of usage examples for android.app Notification DEFAULT_VIBRATE

Introduction

In this page you can find the example usage for android.app Notification DEFAULT_VIBRATE.

Prototype

int DEFAULT_VIBRATE

To view the source code for android.app Notification DEFAULT_VIBRATE.

Click Source Link

Document

Use the default notification vibrate.

Usage

From source file:com.sentaroh.android.TaskAutomation.TaskExecutor.java

final static private void showMessageNotification(TaskManagerParms taskMgrParms, EnvironmentParms envParms,
        CommonUtilities util, TaskResponse tr, String m_text, int led_color, int led_on, int led_off) {
    NotificationManager nm = (NotificationManager) taskMgrParms.context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    NotificationCompat.Builder nb = new NotificationCompat.Builder(taskMgrParms.context);
    nm.cancel("MSG", taskMgrParms.msgNotificationId);
    Intent in = new Intent();
    PendingIntent pi = PendingIntent.getActivity(taskMgrParms.context, 0, in,
            PendingIntent.FLAG_CANCEL_CURRENT);
    pi.cancel();/*w  ww . java2s. c om*/
    nb.setContentIntent(pi).setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND)
            .setOngoing(false).setAutoCancel(true).setSmallIcon(R.drawable.action)
            .setContentTitle(taskMgrParms.context.getString(R.string.app_name)).setContentText(m_text)
            .setWhen(System.currentTimeMillis());
    if (led_color != 0)
        nb.setLights(led_color, led_on, led_off);
    Notification nf = nb.build();
    nm.notify("MSG", taskMgrParms.msgNotificationId, nf);
    synchronized (envParms) {
        if (taskMgrParms.msgNotificationId >= MAX_NOTIFICATION_COUNT)
            taskMgrParms.msgNotificationId = 1;
        else
            taskMgrParms.msgNotificationId++;
    }
}