I have a method that create notifications. In that method I am looping a list. According to that list I am creating notification. Notifications are creating correctly but the problem is no vibration occurs for any notifications. Also light not working.
protected void displayNotification(ArrayList<OpenNotificationData> li) {
for (int i = 0; i < li.size(); i++) {
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "id");
mBuilder.setContentTitle("PM Notification");
mBuilder.setContentText("You've received new message");
mBuilder.setTicker("New Message Alert!");
mBuilder.setAutoCancel(true);
mBuilder.setSmallIcon(R.drawable.ceat_noti);
mBuilder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
mBuilder.setLights(Color.RED, 3000, 3000);
/* Add Big View Specific Configuration */
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
// Sets a title for the Inbox style big view
inboxStyle.setBigContentTitle("PM notification");
// Moves events into the big view
inboxStyle.addLine(li.get(i).getSection());
inboxStyle.addLine(li.get(i).getMachine());
inboxStyle.addLine(li.get(i).getBreakDwon());
mBuilder.setStyle(inboxStyle);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (mNotificationManager != null) {
mNotificationManager.notify(i, mBuilder.build());
}
}
}
I also add AndroidManifest VIBRATE permission