This is the part of code with the problem:
Intent intent = new Intent(MyGcmListenerService.this, CalcularHorariosDisponiblesComplejo.class);
intent.putExtra("idComplejo",idComplejoSeleccionado);
intent.putExtra("idCancha",idCanchaSeleccionada);
intent.putExtra("idUsuarioComplejo",idUsuarioComplejo);
intent.putExtra("idPais",idPais);
intent.putExtra("nombreComplejo", nombreComplejo);
intent.putExtra("dia",day);
intent.putExtra("mes",month);
intent.putExtra("anio",year);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
MyGcmListenerService.this,
m,
intent,
PendingIntent.FLAG_UPDATE_CURRENT
);//creamos la notificacion
NotificationCompat.Builder n = new NotificationCompat.Builder(MyGcmListenerService.this)
.setContentTitle(titulo)
.setSound(uri)
.setSmallIcon(R.drawable.notification_icon)
.setLargeIcon(bm)
.setStyle(new NotificationCompat.BigTextStyle().bigText("El usuario " + nombreOrigen + " " + mensaje))
.setContentIntent(resultPendingIntent)
.setAutoCancel(true);
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(m, n.build());
}
The pendingIntent works great, but I change the CalcularHorariosDisponiblesComplejo.class for a AsyncTask. Now I call the sameclass like this:
new CalcularHorariosComplejoAsyncTask(MyGcmListenerService.this, idComplejoSeleccionado, idCanchaSeleccionada, nombreComplejo, idUsuarioComplejo, idPais, String.valueOf(day),String.valueOf(month),String.valueOf(year)).execute();
The problem that now I can't use pending intent, so I try to replace something like this but is not working:
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
MyGcmListenerService.this,
m,
new CalcularHorariosComplejoAsyncTask(MyGcmListenerService.this, idComplejoSeleccionado, idCanchaSeleccionada, nombreComplejo, idUsuarioComplejo, idPais, String.valueOf(day),String.valueOf(month),String.valueOf(year)).execute(),
PendingIntent.FLAG_UPDATE_CURRENT);
How can I call from PendingIntent to a Asynctask?