通知没有任何声音或振动

时间:2016-11-20 16:36:32

标签: android audio notifications vibrate

收到通知后,我听不到声音和振动。对于信息,手机不处于静音模式。

    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                    .setAutoCancel(true)
                    .setContentText(message)
                    .setSmallIcon(R.drawable.common_google_signin_btn_icon_dark)
                    .setContentIntent(pendingIntent);
    long[] pattern = {500,500,500};
    builder.setVibrate(pattern);
    Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    builder.setSound(alarmSound); 
    NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    manager.notify(0,builder.build());

0 个答案:

没有答案