getIntent() Extras toujours NULL

J'ai écrit une simple Application Android qui montrent une coutume de Notification comme ceci:

Context context = getApplicationContext();          
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification( R.drawable.icon, title, System.currentTimeMillis());  
Intent notificationIntent = new Intent( context,  this.getClass()); 
notificationIntent.putExtra("com.mysecure.lastpage", "SECURECODE"); 
PendingIntent pendingIntent = PendingIntent.getActivity( context , 0, notificationIntent, 0);               
notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
notification.contentView = new RemoteViews(context.getPackageName(), R.layout.notifypbar);
notification.contentIntent = pendingIntent;

notification.contentView.setTextViewText(R.id.notifypb_status_text, text);
notification.contentView.setProgressBar(R.id.notifypb_status_progress, 100, (int)(100*progress), false);

manager.notify(104, notification);

Ce morceau de code est appelé qu'une SEULE FOIS dans ma demande et il affiche une notification avec une barre de progression (tous correctement).

Désormais, lorsqu'un utilisateur clique sur cette notification de mon application gère les onResume événement.

public void onResume()
{
    super.onResume();
    //TODO: Extras è SEMPRE NULL!!! impossibile!
    Intent callingintent = getIntent(); 
    Bundle extras = callingintent.getExtras();

mais extras est toujours NULLE!

J'ai essayé toute combinaison de:

notificationIntent.putExtra("com.mysecure.lastpage", "SECURECODE");

ou

Bundle extra = new Bundle();
extra.putString(key, value);
notificationIntent.putExtra(extra);

mais getIntent().getExtras() renvoie toujours NULL.

  • Avez-vous essayer de définir le Contexte de l'Application à l'intérieur de la Notification?
InformationsquelleAutor Magius | 2011-06-15