Example usage for android.media AudioManager RINGER_MODE_VIBRATE

List of usage examples for android.media AudioManager RINGER_MODE_VIBRATE

Introduction

In this page you can find the example usage for android.media AudioManager RINGER_MODE_VIBRATE.

Prototype

int RINGER_MODE_VIBRATE

To view the source code for android.media AudioManager RINGER_MODE_VIBRATE.

Click Source Link

Document

Ringer mode that will be silent and will vibrate.

Usage

From source file:com.appsaur.tarucassist.AutomuteAlarmReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    int mReceivedID = Integer.parseInt(intent.getStringExtra(BaseActivity.EXTRA_REMINDER_ID));

    // Get notification title from Reminder Database
    ScheduleAutomuteDataSource scheduleAutomuteDataSource = new ScheduleAutomuteDataSource(context);
    scheduleAutomuteDataSource.open();/*from w ww .  ja v  a 2  s.  com*/
    ScheduleAutomute scheduleAutomute = scheduleAutomuteDataSource.getScheduleAutomute(mReceivedID);
    mCalendar = Calendar.getInstance();

    myAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

    if (scheduleAutomute.getAutomuteMode().equals("Vibrate")) {
        myAudioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
    } else if (scheduleAutomute.getAutomuteMode().equals("Silent")) {
        myAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
    } else if (scheduleAutomute.getAutomuteMode().equals("Normal"))
        myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

}

From source file:com.kaliturin.blacklist.utils.Notifications.java

private static void notify(Context context, String title, String message, String ticker, @DrawableRes int icon,
        String action, Uri ringtone, boolean vibration) {

    // turn off sound and vibration if phone is in silent mode
    AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    switch (am.getRingerMode()) {
    case AudioManager.RINGER_MODE_SILENT:
        ringtone = null;/*from ww  w.j a va2s  .  c  o  m*/
        vibration = false;
        break;
    case AudioManager.RINGER_MODE_VIBRATE:
        ringtone = null;
        break;
    case AudioManager.RINGER_MODE_NORMAL:
        break;
    }

    // pending intent for activating app on click in status bar
    Intent intent = new Intent(context, MainActivity.class);
    intent.setAction(action);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

    // build notification
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    builder.setContentIntent(pendingIntent);
    builder.setContentTitle(title);
    builder.setTicker(ticker);
    builder.setContentText(message);
    builder.setSmallIcon(icon);
    builder.setColor(getColor(context, R.attr.colorAccent));
    builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher));
    builder.setPriority(PRIORITY_MAX);
    builder.setAutoCancel(true);
    if (ringtone != null) {
        builder.setSound(ringtone);
    }
    if (vibration) {
        builder.setVibrate(new long[] { 0, 300, 300, 300 });
    }
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(0, builder.build());
}

From source file:com.sublimis.urgentcallfilter.Magic.java

private boolean isRingerInRightMode() {
    boolean retVal = false;

    if (mAudioManager != null) {
        int ringerScope = MyPreference.getScope();

        switch (mRingerModeOriginal) {
        case AudioManager.RINGER_MODE_SILENT:
            if ((ringerScope & 1) != 0)
                retVal = true;/*from   w w w.j a va 2  s  .  c  o  m*/
            break;
        case AudioManager.RINGER_MODE_VIBRATE:
            if ((ringerScope & 2) != 0)
                retVal = true;
            break;
        case AudioManager.RINGER_MODE_NORMAL:
            if ((ringerScope & 4) != 0) {
                if (mVolumeOriginal < mVolumeMax)
                    retVal = true;
            }
            break;
        }
    }

    return retVal;
}

From source file:com.hari.autotasx.GeofenceTransitionsIntentService.java

@Override
protected void onHandleIntent(Intent intent) {

    GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);
    if (geofencingEvent.hasError()) {
        String errorMessage = GeofenceErrorMessages.getErrorString(this, geofencingEvent.getErrorCode());
        // Log.e(TAG, errorMessage);
        return;/*  ww w  .j  a  va 2 s .  c  o m*/
    }

    int geofenceTransition = geofencingEvent.getGeofenceTransition();
    int smsDb = 0;
    int wifiDb = 0;
    int silDb = 0;
    int RemDb = 0;
    int blueDb = 0;
    int carDb = 0;
    String remMsgDb = null;
    int RemDb_carPark = 0;
    String remMsgDb_carPark = null;
    //Creating database object to fetch values
    ManageDB autodb = new ManageDB(this);
    autodb.open();

    if (!CarParkService.car_flag_static) {
        Cursor cursor = autodb.getEntry(ActionFragment.geoFence);
        cursor.moveToFirst();

        //System.out.println("cursor count"+cursor.getCount());

        //Log.i("logcat",cursor.getString(0)+", "+cursor.getString(1)+" , "+cursor.getString(2));
        smsDb = cursor.getInt(5);
        wifiDb = cursor.getInt(6);
        silDb = cursor.getInt(7);
        RemDb = cursor.getInt(8);
        remMsgDb = cursor.getString(9);
        blueDb = cursor.getInt(10);
        carDb = cursor.getInt(11);

        cursor.close();

    } else {
        Cursor cursor_carpark = autodb.getEntryCarPark(CarParkService.geofence_carpark);
        cursor_carpark.moveToFirst();

        carDb = cursor_carpark.getInt(11);
        remMsgDb_carPark = cursor_carpark.getString(9);

        cursor_carpark.close();
    }
    autodb.close();

    //Checking Enter/Exit transitions
    if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER) {
        List<Geofence> triggeringGeofences = geofencingEvent.getTriggeringGeofences();
        String geofenceTransitionDetails = getGeofenceTransitionDetails(this, geofenceTransition,
                triggeringGeofences);
        System.out.println("smsdb" + smsDb);
        if (RemDb == 1) {
            sendNotification(geofenceTransitionDetails, remMsgDb);
        }
        if (carDb == 1) {
            sendNotification(geofenceTransitionDetails, remMsgDb_carPark);
        }
        //Perform actions if set on Actions set
        if (silDb == 1) {
            Toast.makeText(this, "silent", Toast.LENGTH_SHORT).show();
            AudioManager am = (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);
            am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);

        }

        if (wifiDb == 1) {
            WifiManager wifiManager = (WifiManager) getBaseContext().getSystemService(Context.WIFI_SERVICE);
            wifiManager.setWifiEnabled(true);
        }

        if (blueDb == 1) {
            BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            if (!mBluetoothAdapter.isEnabled()) {
                mBluetoothAdapter.enable();
            }
        }
        if (smsDb == 1) {
            Toast.makeText(this, "inside sendsms()", Toast.LENGTH_SHORT).show();
            SmsManager sm = SmsManager.getDefault();
            System.out.printf("sm", sm);
            sm.sendTextMessage(ActionFragment.smsNo, null,
                    "Hi, I am in " + ActionFragment.geoFence.getNameLoc() + " now!!!!", null, null);
        }
        if (carDb == 1) {
            Intent mapIntent = new Intent(this, CarParkMap.class);
            mapIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }

    } else if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {
        List<Geofence> triggeringGeofences = geofencingEvent.getTriggeringGeofences();
        String geofenceTransitionDetails = getGeofenceTransitionDetails(this, geofenceTransition,
                triggeringGeofences);
        if (silDb == 1) {
            Toast.makeText(this, "general", Toast.LENGTH_SHORT).show();
            AudioManager am1 = (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);
            am1.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        }

        if (wifiDb == 1) {
            WifiManager wifiManager1 = (WifiManager) getBaseContext().getSystemService(Context.WIFI_SERVICE);
            wifiManager1.setWifiEnabled(false);
        }
        if (blueDb == 1) {
            BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            if (mBluetoothAdapter.isEnabled()) {
                mBluetoothAdapter.disable();
            }
        }
        if (smsDb == 1) {
            Toast.makeText(this, "inside sendsms()", Toast.LENGTH_SHORT).show();
            SmsManager sm = SmsManager.getDefault();
            System.out.printf("smsNo :" + ActionFragment.smsNo);
            //fetch
            sm.sendTextMessage(ActionFragment.smsNo, null,
                    "Hi, I am outside " + ActionFragment.geoFence.getNameLoc() + " now !!!", null, null);
        }
        if (RemDb == 1) {
            sendNotification(geofenceTransitionDetails, remMsgDb);
        }

    }

}

From source file:org.libreoffice.impressremote.activity.SlideShowActivity.java

private void enableQuietMode() {
    if (!isQuietModeRequired()) {
        return;
    }

    getAudioManager().setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
}

From source file:com.ssm.broadcast.GcmIntentService.java

private void sendNotification(String msg) {

    //msg? ?? ? ?? ? ? ?.

    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, DemoActivity.class), 0);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_stat_gcm).setTicker("PeopleTree").setContentTitle("PeopleTree")
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
            //.setWhen(System.currentTimeMillis())
            .setContentText(msg);/*from  w ww . ja va2  s.  co  m*/

    AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);

    /* Even if the mode is set to "Sound & Vibration" in the phone, 
     * the status code that getRingerMode() returns is RINGER_MODE_NORMAL.
     */
    switch (am.getRingerMode()) {
    case AudioManager.RINGER_MODE_VIBRATE:
        mBuilder.setDefaults(Notification.DEFAULT_VIBRATE);
        break;
    case AudioManager.RINGER_MODE_NORMAL:
        mBuilder.setDefaults(Notification.DEFAULT_SOUND);
        break;
    default:
        mBuilder.setDefaults(Notification.DEFAULT_SOUND);
    }

    mBuilder.setContentIntent(contentIntent);
    mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}

From source file:com.ayaseya.padnotification.GcmIntentService.java

@Override
public void onCreate() {
    super.onCreate();

    ringerMode = false;//from ww  w  . j  av  a 2 s  . c  o  m
    silentMode = false;
    vibrateMode = false;

    isPlugged = false;

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    checkbox_sound = sharedPreferences.getBoolean("checkbox_sound_key", true);
    checkbox_vibration = sharedPreferences.getBoolean("checkbox_vibration_key", false);

    Set<String> multiValues = sharedPreferences.getStringSet("list_preference", null);
    ArrayList<String> timeZone = new ArrayList<String>();

    if (multiValues != null) {

        timeZone.addAll(multiValues);
        Collections.sort(timeZone);
        for (int i = 0; i < timeZone.size(); i++) {
            //            Log.v(TAG, "TimeZone=" + timeZone.get(i));
        }

        Calendar calendar = Calendar.getInstance();
        int hour = calendar.get(Calendar.HOUR_OF_DAY);
        if (timeZone.indexOf(String.valueOf(hour)) == -1) {
            notificationPermission = false;
            Log.v(TAG, "?????????");
        } else {
            notificationPermission = true;
            Log.v(TAG, "??????");
        }
    }

    vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);

    ringerModeStateChangeReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // ?
            if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
                if (intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1) == AudioManager.RINGER_MODE_NORMAL) {
                    // 
                    ringerMode = true;
                } else {
                    ringerMode = false;

                }

                if (intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE,
                        -1) == AudioManager.RINGER_MODE_VIBRATE) {
                    // 
                    vibrateMode = true;

                } else {

                    vibrateMode = false;

                }

                if (intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1) == AudioManager.RINGER_MODE_SILENT) {
                    // 
                    silentMode = true;

                } else {

                    silentMode = false;

                }
            }
        }
    };

    plugStateChangeReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // ?
            if (intent.getIntExtra("state", 0) > 0) {
                isPlugged = true;
                //               Log.v(TAG, "IN");
            } else {
                isPlugged = false;
                //               Log.v(TAG, "OUT");
            }
        }
    };

    // Broadcast Receiver???
    registerReceiver(plugStateChangeReceiver, plugIntentFilter);
    registerReceiver(ringerModeStateChangeReceiver, ringerModeIntentFilter);
}

From source file:com.ayaseya.nolnotification.GcmIntentService.java

@Override
public void onCreate() {
    super.onCreate();

    ringerMode = false;/*  w  w  w  .  j  a  va  2 s.  co m*/
    silentMode = false;
    vibrateMode = false;

    isPlugged = false;

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    checkbox_sound = sharedPreferences.getBoolean("checkbox_sound_key", true);
    checkbox_vibration = sharedPreferences.getBoolean("checkbox_vibration_key", false);

    Set<String> multiValues = sharedPreferences.getStringSet("list_preference", null);
    ArrayList<String> timeZone = new ArrayList<String>();

    if (multiValues != null) {

        timeZone.addAll(multiValues);
        Collections.sort(timeZone);
        for (int i = 0; i < timeZone.size(); i++) {
            //            Log.v(TAG, "TimeZone=" + timeZone.get(i));
        }

        Calendar calendar = Calendar.getInstance();
        int hour = calendar.get(Calendar.HOUR_OF_DAY);

        if (timeZone.indexOf(String.valueOf(hour)) == -1) {
            notificationPermission = false;
            //            Log.v(TAG, "?????????");
        } else {
            notificationPermission = true;
            //            Log.v(TAG, "??????");
        }
    }

    vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);

    ringerModeStateChangeReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // ?
            if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
                if (intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1) == AudioManager.RINGER_MODE_NORMAL) {
                    // 
                    ringerMode = true;
                } else {
                    ringerMode = false;

                }

                if (intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE,
                        -1) == AudioManager.RINGER_MODE_VIBRATE) {
                    // 
                    vibrateMode = true;

                } else {

                    vibrateMode = false;

                }

                if (intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1) == AudioManager.RINGER_MODE_SILENT) {
                    // 
                    silentMode = true;

                } else {

                    silentMode = false;

                }
            }
        }
    };

    plugStateChangeReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // ?
            if (intent.getIntExtra("state", 0) > 0) {
                isPlugged = true;
                //               Log.v(TAG, "IN");
            } else {
                isPlugged = false;
                //               Log.v(TAG, "OUT");
            }
        }
    };

    // Broadcast Receiver???
    registerReceiver(plugStateChangeReceiver, plugIntentFilter);
    registerReceiver(ringerModeStateChangeReceiver, ringerModeIntentFilter);
}

From source file:com.zion.htf.receiver.AlarmReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Get preferences
    Resources res = context.getResources();
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);

    int setId, alarmId;
    try {/*from  w  w w .ja v a  2 s  . c  o m*/
        if (0 == (setId = intent.getIntExtra("set_id", 0)))
            throw new MissingArgumentException("set_id", "int");
        if (0 == (alarmId = intent.getIntExtra("alarm_id", 0)))
            throw new MissingArgumentException("alarm_id", "int");
    } catch (MissingArgumentException e) {
        throw new RuntimeException(e.getMessage());
    }

    // Fetch info about the set
    try {
        // VIBRATE will be added if user did NOT disable notification vibration
        // SOUND won't as it is set even if it is to the default value
        int flags = Notification.DEFAULT_LIGHTS;
        MusicSet set = MusicSet.getById(setId);
        Artist artist = set.getArtist();

        SimpleDateFormat dateFormat;
        if ("fr".equals(Locale.getDefault().getLanguage())) {
            dateFormat = new SimpleDateFormat("HH:mm", Locale.FRANCE);
        } else {
            dateFormat = new SimpleDateFormat("h:mm aa", Locale.ENGLISH);
        }

        // Creates an explicit intent for an Activity in your app
        Intent resultIntent = new Intent(context, ArtistDetailsActivity.class);
        resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);// Do not start a  new activity but reuse the existing one (if any)
        resultIntent.putExtra(ArtistDetailsActivity.EXTRA_SET_ID, setId);

        // Manipulate the TaskStack in order to get a good back button behaviour. See http://developer.android.com/guide/topics/ui/notifiers/notifications.html
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
        stackBuilder.addParentStack(ArtistDetailsActivity.class);
        stackBuilder.addNextIntent(resultIntent);
        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

        // Extract a bitmap from a file to use a large icon
        Bitmap largeIconBitmap = BitmapFactory.decodeResource(context.getResources(),
                artist.getPictureResourceId());

        // Builds the notification
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
                .setPriority(NotificationCompat.PRIORITY_MAX).setSmallIcon(R.drawable.ic_stat_notify_app_icon)
                .setLargeIcon(largeIconBitmap).setAutoCancel(true).setContentIntent(resultPendingIntent)
                .setContentTitle(artist.getName())
                .setContentText(String.format(context.getString(R.string.alarm_notification), artist.getName(),
                        set.getStage(), dateFormat.format(set.getBeginDate())));

        // Vibrate settings
        Boolean defaultVibrate = true;
        if (!pref.contains(res.getString(R.string.pref_key_notifications_alarms_vibrate))) {
            // Get the system default for the vibrate setting
            AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
            if (null != audioManager) {
                switch (audioManager.getRingerMode()) {
                case AudioManager.RINGER_MODE_SILENT:
                    defaultVibrate = false;
                    break;
                case AudioManager.RINGER_MODE_NORMAL:
                case AudioManager.RINGER_MODE_VIBRATE:
                default:
                    defaultVibrate = true;
                }
            }
        }
        Boolean vibrate = pref.getBoolean(res.getString(R.string.pref_key_notifications_alarms_vibrate),
                defaultVibrate);

        // Ringtone settings
        String ringtone = pref.getString(res.getString(R.string.pref_key_notifications_alarms_ringtone),
                Settings.System.DEFAULT_NOTIFICATION_URI.toString());

        // Apply notification settings
        if (!vibrate) {
            notificationBuilder.setVibrate(new long[] { 0l });
        } else {
            flags |= Notification.DEFAULT_VIBRATE;
        }

        notificationBuilder.setSound(Uri.parse(ringtone));

        // Get the stage GPS coordinates
        try {
            Stage stage = Stage.getByName(set.getStage());

            // Add the expandable notification buttons
            PendingIntent directionsButtonPendingIntent = PendingIntent
                    .getActivity(context, 1,
                            new Intent(Intent.ACTION_VIEW,
                                    Uri.parse(String.format(Locale.ENGLISH,
                                            "http://maps.google.com/maps?f=d&daddr=%f,%f", stage.getLatitude(),
                                            stage.getLongitude()))),
                            Intent.FLAG_ACTIVITY_NEW_TASK);
            notificationBuilder.addAction(R.drawable.ic_menu_directions,
                    context.getString(R.string.action_directions), directionsButtonPendingIntent);
        } catch (InconsistentDatabaseException e) {
            // Although this is a serious error, its impact on functionality is minimal.
            // Report this through piwik
            if (BuildConfig.DEBUG)
                e.printStackTrace();
        }

        // Finalize the notification
        notificationBuilder.setDefaults(flags);
        Notification notification = notificationBuilder.build();

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(set.getStage(), 0, notification);

        SavedAlarm.delete(alarmId);
    } catch (SetNotFoundException e) {
        throw new RuntimeException(e.getMessage());
        // TODO: Notify that an alarm was planned but some error prevented to display it properly. Open AlarmManagerActivity on click
        // Report this through piwik
    }
}

From source file:com.whereismyfriend.GcmIntentService.java

private void sendNotification(String msg, String badge, String type) {
    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    int notification_id;
    PendingIntent contentIntent;/*from w ww  . jav a 2 s  . c o  m*/
    if (type.compareTo("s") == 0) {
        contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, Solicitudes.class), 0);
        notification_id = 0;
    } else {
        contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, Mapa.class), 0);
        notification_id = 1;
    }

    if (Integer.parseInt(badge) > 1) {
        if (type.compareTo("s") == 0)
            msg = getResources().getString(R.string.push_no_leidas_1) + " " + badge + " "
                    + getResources().getString(R.string.push_no_leidas_2);
        else
            msg = getResources().getString(R.string.push_no_leidas_1_acc) + " " + badge + " "
                    + getResources().getString(R.string.push_no_leidas_2_acc);
    }

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_stat_gcm).setContentTitle(getResources().getString(R.string.app_name))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg)
            .setAutoCancel(true);

    AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    switch (am.getRingerMode()) {
    case AudioManager.RINGER_MODE_SILENT:
        mBuilder.setLights(Color.CYAN, 3000, 3000);
        break;
    case AudioManager.RINGER_MODE_VIBRATE:
        mBuilder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
        mBuilder.setLights(Color.CYAN, 3000, 3000);
        break;
    case AudioManager.RINGER_MODE_NORMAL:
        mBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
        mBuilder.setLights(Color.CYAN, 3000, 3000);
        break;
    }

    mBuilder.setContentIntent(contentIntent);
    mNotificationManager.notify(notification_id, mBuilder.build());
}