Обновить вибрацию/мелодию уведомления

Я использую построитель NotificationManager, чтобы показать предупреждение в своем приложении. Я знаю, что первым параметром для метода notifyявляется идентификатор, и платформа обновит уведомление, если оно уже видно, но если я настрою оповещение на воспроизведение мелодии звонка или вибрацию, мелодия звонка/вибрация также сработает, если предупреждение обновляется?

    NotificationCompat.Builder nb = new NotificationCompat.Builder(this);
    nb.setContentTitle("title");
    nb.setContentText("message");
    nb.setSmallIcon(getResources().getIdentifier("drawable/alert", null, packageName));
    nb.setWhen(System.currentTimeMillis());
    nb.setAutoCancel(true);
    nb.setTicker("message");

    final Uri ringtone = Uri.parse(PreferenceManager.getDefaultSharedPreferences(this).getString("ringtone", getString(R.string.settings_default_ringtone)));

    nb.setDefaults(Notification.DEFAULT_VIBRATE);
    nb.setSound(ringtone);      
    nb.setDefaults(Notification.DEFAULT_LIGHTS);

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

    final Intent notificationIntent = new Intent(this, Main.class);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);

    final PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    nb.setContentIntent(contentIntent);

    Notification notification = nb.getNotification();

    nm.notify(0, notification);
7
задан Kris B 4 May 2012 в 16:26
поделиться