[英]How to make my android application launched in the boot and then hidden
I developed an android application that launch a backbone service at the onCreate()
. 我开发了一个Android应用程序,该应用程序在
onCreate()
启动主干服务。
1) In the device boot , I want that my application start automatically and then make its interface hidden (not closed) 1) 在设备启动中 ,我希望我的应用程序自动启动,然后使其界面隐藏 (不关闭)
2) In the usual usage , If I open my application manyally (not in the boot), I do not want to make my application interface hidden. 2) 在通常的用法中 ,如果我多次打开应用程序(不在引导中),则不想隐藏应用程序界面。
Is it possible to fit these 2 requirements with Android? Android是否可以满足这两个要求?
Do you want to show any UI (like splash screen) to user on every bootup? 您是否要在每次启动时向用户显示任何UI(例如初始屏幕)? or you want to do any background operations?
或者您想进行任何后台操作?
Try using Boot Receiver(android.intent.action.BOOT_COMPLETED) it will solve your both requirements 尝试使用Boot Receiver(android.intent.action.BOOT_COMPLETED),它将同时满足您的两个要求
Thanks, Jey. 谢谢,杰
Use the android service. 使用android服务。 and in the service
onStart()
method launch the service you want as a background task. 并在service
onStart()
方法中启动所需的服务作为后台任务。
To launch the service in the boot of the android, use BroadcastReceiver
class 要在android的启动中启动服务,请使用
BroadcastReceiver
类
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.