Why not? Post a notification, give it a PendingIntent pointing to your
login activity:
Intent intent = new Intent(this, MyLoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pintent =
PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
notification.setLatestEventInfo(getApplicationContext(),
getString(R.string.notification_title),
getString(R.string.notification_text),
pintent);
mgr.notify(LAUNCH_NOTIFICATION_ID, notification);
(Thanks for asking -- my code had broken with a reorg of my class
hierarchy, so my activity class was no longer the one in the manifest!
So I just fixed my app as a result of your question!)
Your login activity must, of course, be in the manifest.
On Mar 10, 6:23 am, ailinykh <[email protected]> wrote:
> It's not about notification. If session is expired I have to start
> LoginActivity. As far as I understand NotificationManager
> can't help here.
>
> Thank you,
> Andrey
>
> On Mar 10, 12:29 am, Dianne Hackborn <[email protected]> wrote:
>
>
>
> > You should never start any activity outside of an existing activity. Thus
> > to get a result, you need to be starting from an activity. If you want to
> > inform the user of something going on from the background, you should use
> > the notification manager.
>
> > On Tue, Mar 9, 2010 at 9:20 PM, ailinykh <[email protected]> wrote:
> > > Hello, everybody!
> > > I'm doing some network job in AsyncTask. Sometimes it requires
> > > communication with user. (connection is dropped, session is expired
> > > and so on). I want to pop up a dialog or launch an Activity, and then,
> > > depending on user's input, stop the job or redo it.
> > > I can launch any Activity from AsyncTask, but how to get result back?
> > > It seems to be possible only if I launch new Activity from another
> > > Activity. What are possible solutions?
>
> > > Thank you,
> > > Andrey
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%2Bunsubs
> > > [email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails. All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en