如果手机正在通话,Android通知不会振动

时间:2017-02-08 11:24:37

标签: android android-notifications

我测试通常当我创建通知电话振动但在通话期间它只是播放声音但不振动任何解决方案或者我们是否可以通知在任何情况下强制振动如果默认振动不允许来自OS方面? 这是我的代码:

 private final long[] vibration_pattern = new long[]{0, 700, 200, 100, 100, 600, 200, 100, 100, 600, 200, 100, 100, 900};

 NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext);
        notificationBuilder.setAutoCancel(true)
                .setWhen(System.currentTimeMillis())
                .setSmallIcon(R.drawable.icon)
                .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher))
                .setContentTitle(title)
                .setContentText(zone)
                .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND)
                .setContentIntent(PendingIntent.getBroadcast(mContext, 1, intent, 0))
                .setVibrate(vibration_pattern);
        notificationManager.notify(notificationId++, notificationBuilder.build());

0 个答案:

没有答案