简体   繁体   English

如何使我的android应用程序在启动时启动然后隐藏

[英]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.

相关问题 如何检测我的应用程序是否从IntelliJ启动? - How to detect if my application was launched from IntelliJ? 如何处理从我的应用程序启动的应用程序 - How to manipulate the application that I launched from my application 在启动我的Android应用程序时出现错误 - Error in the start of my android application in the boot 如何在 Android 应用程序中创建隐藏文件夹? - How to create a hidden folder into an Android Application? 如何改革我的Android应用程序以使其与layout()函数一起使用 - How to reform my Android application to make it work with the layout() function 如何在上下文创建错误后使用spring-boot-starter-actuator完成弹簧启动应用程序? - How to make my spring-boot application with spring-boot-starter-actuator finish after context creation error? 如何为我的Android应用程序制作推送通知服务器? - How to make Push notification server for my android application? 如何让我的 spring 启动应用程序使用给定的用户名和密码登录到 keycloak? - How can I make my spring boot application to log in to keycloak with given username and password? 从.jar手动启动Spring Boot应用程序无法正常工作 - Manually launched Spring Boot application from .jar not working properly 启动/关闭启动时使我的应用程序启动 - make my application start when boot complete on/off
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM