Using a Notification is one way to go about it. The Notification can
be linked to an Activity, which gets launched if the user clicks on
the Notification. Here's some code, which I think I pulled from some
tutorial someplace:
CharSequence text = getText(R.string.remote_service_started);
// Set the icon, scrolling text and timestamp
Notification notification = new Notification(R.drawable.icon,
text,
System.currentTimeMillis());
// The PendingIntent to launch our activity if the user
selects this notification
PendingIntent contentIntent = PendingIntent.getActivity(this,
0,
new Intent(this, MyActivity.class), 0);
// Set the info for the views that show in the notification
panel.
notification.setLatestEventInfo(this, getText
(R.string.remote_service_label),
text, contentIntent);
// Send the notification.
// We use a string id because it is a unique number. We use
it later to cancel.
mNM.notify(R.string.remote_service_started, notification);
Good luck!
On Apr 3, 5:03 am, jj <[email protected]> wrote:
> Hello
> I want run my application in background, with "Service
> component",
> If the application is running in background then there should be icon
> of application, so when user click on icon the application should come
> in fore ground.
> Is this possible in Android, anybody having suggestions plz
> welcome.
> There is provision of Notification Manager for icon, but it is not
> reacting to user events. Is there any other way to this.
>
> Thank you
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---