Android 服务首选项的 UI

发布于 2024-10-28 08:39:47 字数 235 浏览 2 评论 0原文

我有一个只有服务的应用程序,该服务将通过bindService按需使用。所以它不是一个长期运行的服务。

但该服务确实有相关的偏好。

此类服务的首选项 UI 的首选模型是什么?通知似乎不正确,因为该服务通常不运行。我看到的唯一其他选项是在启动器中显示的应用程序中添加一个活动。

但有一个名为“Service X 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听,心雨的声音 2024-11-04 08:39:47

此类服务的首选项 UI 的首选模型是什么?

拥有用户用来设置首选项的 PreferenceActivity

通知似乎不正确,因为该服务通常不运行。

通知是只读的,不能用于收集偏好设置。

我看到的唯一其他选项是在启动器中显示的应用程序中添加一个活动

通常,PreferenceActivity 不在启动器中,而是从组成应用程序的活动中访问。

如果你说你没有其他活动,你不妨写一些。用户倾向于拒绝市场上评级较低的无活动应用程序,因为它们被认为本质上是有问题的。如果用户在安装后几秒钟内无法弄清楚如何启动应用程序,那么您就会遇到问题。

此外,您的应用程序中的某些内容正在调用 bindService(),并且它不能是 BroadcastReceiver,因此推测它是一个 Activity。只需从那里向您的 PreferenceActivity 提供一个选项菜单项即可。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文