geary
geary

Reputation: 21

UI for Android Service Preferences

I have an application with only a service, and the service will be used on demand via bindService. So it is not a long running service.

But the service does have associated preferences.

What is the preferred model for the preferences UI for such a service? Notifications don't seem right, since the service isn't usually running. The only other option I see is to add an Activity in the application that is shown in the Launcher.

But it seems a little strange having a launcher icon called something like "Service X Preferences".

Are there some other options that I don't know of?

Upvotes: 1

Views: 438

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006664

What is the preferred model for the preferences UI for such a service?

Have a PreferenceActivity that the user uses to set the preferences.

Notifications don't seem right, since the service isn't usually running.

Notifications are read-only and cannot be used to collect preferences.

The only other option I see is to add an Activity in the application that is shown in the Launcher

Usually, the PreferenceActivity is not in the launcher, but is reached from the activities that make up the application.

If you are saying that you have no other activities, you may wish to write some. Users tend to reject activity-less applications on the Market, with low ratings, because they are considered intrinsically broken. If the user cannot figure out how to launch the application within a few seconds after installation, you have problems.

Moreover, something in your application is calling bindService(), and it cannot be a BroadcastReceiver, so presumably it is an activity. Just provide an options menu item from there to your PreferenceActivity.

Upvotes: 2

Related Questions