我有一個在Android中的推送通知問題。活動仍然打開,當收到通知推送時雙打
這是,我有一個應用程序與2個活動,第一個是菜單,另一個我顯示地圖。
在應用程序使用通知推送中更改地圖。現在當地圖的活動在屏幕中可見並按下移動設備中的主頁按鈕時,相信它在後臺。
現在應用程序收到通知,打開通知並加載菜單ok的活動,更新地圖數據並顯示地圖活動,但返回到菜單並按返回按鈕退出應用程序並關閉活動,但出現在後臺的地圖的另一活動。這不密切。我可以做什麼???
請幫幫我!!!
代碼的onMessage時收到的通知是這樣的:
@Override
protected void onMessage(Context context, Intent intent){
// Notificacion recibida: informamos al usuario
String message = "Notificación Recibida";
//"Id: " + intent.getExtras().getString("id") + " Status: " + intent.getExtras().getString("status");
//Se crea un nuevo manejador de notificaciones
NotificationManager manejadorNotificaciones = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//Se construye una notificacion basica
NotificationCompat.Builder notificacionPersonalizacion = new NotificationCompat.Builder(this).
setSmallIcon(drawable.ic_launcher).setContentTitle("Aviso SAT").setContentText(message);
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Intent intentoMapaPush = new Intent(this, MenuPrincipal.class);
intentoMapaPush.putExtra("Push", "push");
PendingIntent contIntent = PendingIntent.getActivity(this, 0, intentoMapaPush, 0);
notificacionPersonalizacion.setContentIntent(contIntent);
notificacionPersonalizacion.setSound(alarmSound);
notificacionPersonalizacion.setAutoCancel(true);
Notification notificacion = notificacionPersonalizacion.build();
notificacion.flags= Notification.FLAG_AUTO_CANCEL;
manejadorNotificaciones.notify(NOTIF_ALERTA_ID, notificacion);
}
告訴我們您的通知代碼 – 2014-12-13 06:13:43