Reputation: 73
I'm wondering if it's even possible to perform this. I want to place an icon in the Status Bar of the Android showing that my app is running in background. I'm not talking about a "standard" Notification. I really mean an icon (with no user interaction), like the bluetooth one, when it is activated. I will appreciate your answers even if it's just for saying that it is not possible :) Thanks.
Upvotes: 2
Views: 581
Reputation: 1006664
I really mean an icon (with no user interaction), like the bluetooth one, when it is activated.
That is not possible from an SDK application, sorry. Please use a Notification
.
Upvotes: 2
Reputation: 10673
Take a look at the documentation here. Take a look at the sample code, and where there's logic going on to update the notification, just skip it so that all you have is an icon in the notification bar.
Create the notification in your app's onCreate() and add logic in your onPause() that checks isFinishing() to kill the icon.
if(isFinishing())
{
// remove the notification icon
}
Putting the icon removal in onTerminate() probably isn't a good idea since you may have a very limited window to get done whatever you need to have done.
Upvotes: 0