protected void displayNotification(String response) {
Intent intent = new Intent(context, testActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
Notification notification = new Notification(R.drawable.icon, "Upload Started", System.currentTimeMillis());
notification.setLatestEventInfo(context, "Upload", response, pendingIntent);
nManager.notify((int)System.currentTimeMillis(), notification);
}
Esta función se llamará varias veces. Me gustaría que cada uno notificationiniciara testActivity cuando se hace clic en él. Desafortunadamente, solo la primera notificación inicia testActivity. Al hacer clic en el resto, la ventana de notificación se minimiza.
Información adicional: la función displayNotification()está en una clase llamada UploadManager. Contextse pasa UploadManagerdesde el activityque instancia. La función displayNotification()se llama varias veces desde una función, también en UploadManager, que se ejecuta en un AsyncTask.
Edición 1: Olvidé mencionar que estoy pasando la respuesta de cadena Intent intentcomo un extra.
protected void displayNotification(String response) {
Intent intent = new Intent(context, testActivity.class);
intent.putExtra("response", response);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Esto hace una gran diferencia porque necesito la "respuesta" adicional para reflejar cuál era la respuesta de cadena cuando se creó la notificación. En su lugar, el uso de PendingIntent.FLAG_UPDATE_CURRENTla "respuesta" adicional refleja a qué fue la respuesta de String en la última llamada displayNotification().
Sé por qué esto es por leer la documentación en FLAG_UPDATE_CURRENT. Sin embargo, no estoy seguro de cómo solucionarlo en este momento.