I have done work on push notifications and its working correct but in case till api level 4.0. But notification click does not open the activity in case of api 4.4....I am not able to understand the answer, I have search on KitKat and for notifications it has use Notification.Builder Api,with which it gives the same result.
private void generateNotification(Context context, String message, String id) {
int icon = R.drawable.app_icon;
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
String title = context.getString(R.string.app_name);
JSONObject jobj = new JSONObject();
try {
jobj.put("id", id);
} catch (JSONException e) {
e.printStackTrace();
}
System.out.println("json object" + jobj.toString());
Intent notificationIntent = null;
notificationIntent = new Intent(context, JamInfo.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
notificationIntent.putExtra("longi", longi);
notificationIntent.putExtra("lati", lati);
PendingIntent intent = PendingIntent.getActivity(context, 0,
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_LIGHTS;
}
notificationManager.notify((int) System.currentTimeMillis(),
notification);
}