Android通知振动问题

时间:2018-08-30 16:43:19

标签: android

我似乎无法使用set.Vibrate更改振动的模式/长度。我的代码如下:

     NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "expired")
                .setSmallIcon(R.drawable.emptylove_icon)
                .setColor(getResources().getColor(R.color.colorPrimary))
                .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher_round))
                .setContentTitle(getString(R.string.notification_expired_title))
                .setContentText(notestring + getString(R.string.notification_expired_text))
                .setPriority(NotificationCompat.PRIORITY_MAX)
                .setLights(Color.RED, 3000, 3000)
                .setVibrate(new long[] { 1000, 1000, 1000, 1000})
                .setAutoCancel(true);

这将成功发送带有正确图标,颜色和简单振动的通知。

但是

的任何变体
setVibrate(new long[] { 1000, 2000, 1000, 2000})
不管我输入什么值,

都会导致相同的振动。无论我做什么,振动都保持不变。我在这里想念东西吗?

0 个答案:

没有答案
相关问题