fadedbee
fadedbee

Reputation: 44739

How to add an icon to the Android status bar without creating a notification?

I have read: https://developer.android.com/guide/topics/ui/notifiers/notifications.html but I cannot see how to display an icon on the top of the screen, without making a notification.

I have an app with a long-running service, and I want to show an icon that reflects the internal state of that service, at the top of the screen.

How can I do this?

Upvotes: 0

Views: 605

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

I want to show an icon that reflects the internal state of that service, at the top of the screen. How can I do this?

Make a Notification.

Or, download Android's source code, modify it to allow random apps to put icons in the status bar that the user cannot control, build your modified version of Android, package that into a custom ROM, and convince people to use your custom ROM on their devices.

The only non-Notification status bar icons that apps can semi-directly control are:

  • whether there is a GPS-active icon, by registering for location updates
  • whether there is an alarm-clock icon, by using setAlarmClock() on AlarmManager

Upvotes: 2

Related Questions