No ideas? I really thought that this was a simple question... Still
guess that it's just a "flag thing"... :)

On Dec 24 2009, 7:26 am, mastix mc <masti...@googlemail.com> wrote:
> Hi guys,
>
> first of all - Merry Christmas!!!
>
> I have a strange problem here and spent too many hours figuring out
> what the problem might be. I definitely need your help here now... I'm
> pretty sure this is very easy to fix... if you know how...
>
> I develop a little free app for German O2 customers so that they can
> send their 50 free Web-SMS directly from their Android phone and not
> only via web interface like O2 wants them to. These SMS are sent in
> the background using a service. This service generates notifications
> (e.g. Message sent successfully, Login successful/failed,...)
>
> When I click on that notification the app should open and then display
> the notification message. This works pretty fine as long as the app is
> visible (foreground/active). When putting the app into the background
> it's getting launched as well, but it doesn't display the message...
> then, when I hold down the HOME-Key and select the app... the message
> gets displayed.
>
> See the following video... to show you what I mean...
>
> http://dl.dropbox.com/u/1676562/NotificationIssue.mov
>
> I'm pretty sure it has something to do with the Fflags for my intent,
> so here's my code:
>
> Setting the notification:
>
> Code:
>         // The PendingIntent to launch our activity if the user selects this
>         // notification
>         final Intent notificationIntent = new Intent(ManagerFactory
>                 .getMasterActivity(), MailerActivity.class);
>         notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
>                 | Intent.FLAG_ACTIVITY_SINGLE_TOP);
>         Log.d(TAG, "Set new message to Notification: " + p_message);
>         notificationIntent
>                 .putExtra(Constants.NOTIFICATION_EXTRA_KEY, p_message);
>         Log.d(TAG, "Setting requestCodeToFixNotificationBug: "
>                 + s_requestCodeToFixNotificationBug);
>         final PendingIntent contentIntent = PendingIntent.getActivity(
>                 ManagerFactory.s_service, s_requestCodeToFixNotificationBug++,
>                 notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
>
>         notification.setLatestEventInfo(ManagerFactory.s_service,
> p_tickerText,
>                 p_message, contentIntent);
> Reacting on the incoming intent:
>
> Code:
> /*
>      * (non-Javadoc)
>      *
>      * @see android.app.Activity#onNewIntent(android.content.Intent)
>      */
>     @Override
>     protected final void onNewIntent(final Intent p_intent) {
>         // when called via notification, get the extras
>         Log.d(TAG, "Called onNewIntent...");
>         final Bundle extras = p_intent.getExtras();
>         Log.d(TAG, "Extra: " + extras);
>         if (extras != null
>                 && extras.getString(Constants.NOTIFICATION_EXTRA_KEY) != null
>                 && !extras.getString(Constants.NOTIFICATION_EXTRA_KEY).trim()
>                         .equalsIgnoreCase("")) {
>             Log.d(TAG, "Extra:"
>                     + extras.getString(Constants.NOTIFICATION_EXTRA_KEY));
>             this.showLongMessage(extras
>                     .getString(Constants.NOTIFICATION_EXTRA_KEY));
>         }
>     }
>
> Would be great if someone was able to help me...
>
> Sascha
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to