Service based Android application on Google Play Store(Google Play Store 上基于服务的 Android 应用程序)
问题描述
我正在开发一个应用程序,它只包含一些服务并且没有活动(即没有 UI)
基本上,当用户在他/她的设备上安装应用程序时,我希望有 2 到 3 个服务在后台运行.
I'm developing an application which will consists only of a few services and no activities (i.e. no UI)
Basically I want to have 2 to 3 services to be running in the background right from when user installs the application on his/her device.
对此我有几个问题:
- 应用安装后我的服务将如何启动?我的
BroadcastReceiver
应该监听哪个事件? - 如何打包我的应用程序以将其应用程序部署到 Google Play 商店?
推荐答案
你不能在较新的 Android 上这样做.Android 在启动服务之前特别需要用户交互 - 用户需要物理启动您的应用程序.如果您的应用程序没有显示任何内容,用户将会非常困惑.
You can't do that on newer Androids. Android specifically requires user interaction before starting up services - the user will need to physically start your application. And if your application doesn't show anything, the user is going to be very confused.
因此,创建一个 Activity 向用户解释刚刚发生的事情,并在那里注册您的接收器.
So create one Activity explaining the user what has just happened, and register your receivers there.
这篇关于Google Play Store 上基于服务的 Android 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Google Play Store 上基于服务的 Android 应用程序
基础教程推荐
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01