0

I am using the following code for generating notification in my android application.

Everything working fine, but the vibration continuous still click on the notification bar when a new notification generate. This is only in KitKat , in remaining all working fine. Any idea ?

private static void generateNotification(Context context, String message) {

    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager)
            context.getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(R.drawable.ic_launcher, message, when);
    String title = "Application Name";
    Intent notificationIntent = new Intent(context, MainActivity.class);
    notificationIntent.putExtra("message", message);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
            Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent =
            PendingIntent.getActivity(context, 0, notificationIntent, 0);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.defaults|= Notification.DEFAULT_LIGHTS;
    notification.defaults|= Notification.DEFAULT_VIBRATE;
    notification.flags |= Notification.DEFAULT_LIGHTS;
    notificationManager.notify(0, notification);

}

Thanks in advance

ramesh
  • 4,008
  • 13
  • 72
  • 117
  • take a look here http://stackoverflow.com/questions/21250364/notification-click-not-launch-the-given-activity-on-nexus-phones/21250686#21250686 – Hardik Jan 30 '14 at 12:26
  • thanks for your comment. But still having that problem – ramesh Jan 31 '14 at 04:24

0 Answers0