In cases where I've needed to do this, I call a method from both
onCreate and onNewIntent since, to my knowledge, they don't fire
together; one or the other fires depending on the situation.

In your Intent processing method, you can either pass in an Intent or
have it call getIntent().  Note, if your shared method uses getIntent,
be sure to call setIntent(intent) from within onNewIntent.  For
example:


Option One:

public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);






On Jan 19, 10:37 am, mastix mc <masti...@googlemail.com> wrote:
> Hi,
>
> thanks for the hin, I have now changed the launchmode of my activity
> to "singleTop":
>
> and changed the code to look like this:
>
> // 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_CLEAR_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);
>         return notification;
>
> Still the same issue! So it did not change anything. :( The app is
> running in the background... what the heck is going on here? :(
>
> And @RNekic was right... if the app is not active (running in the
> background), it does not call onNewIntent() but onCreate(). How could
> I tell my code to use the old instance instead of creating a new one?
>
> Sascha
>
> On Jan 18, 9:15 pm, reyden <mr.jakovlje...@gmail.com> wrote:
>
>
>
> > I've had a similar issue with one of my activities that was supposed
> > to be launched via notifications. After some digging I've solved it by
> > declaring "singleTop" launch mode for the activity in manifest and by
> > using FLAG_ACTIVITY_CLEAR_TOP flag on the pending intent for
> > notification manager...
-- 
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