简体   繁体   English

启动时在后台*启动我的android应用程序

[英]Start my android application *in the background* on boot

I am successfully able to start my Android app automatically on boot using BroadcastReceiver with an intent-filter BOOT_COMPLETED. 我可以在启动时使用带有意图过滤器BOOT_COMPLETED的BroadcastReceiver自动启动我的Android应用。 In my onReceive method, I start the launcher activity for my application. 在我的onReceive方法中,我启动了应用程序的启动器活动。

However, I don't want this application to be in the foreground on boot, but I do want it to be on the activity stack. 但是,我不希望此应用程序在启动时处于前台,但我希望它在活动堆栈中。 Is there a way to still have the home screen show up on boot, but also have my application starts up. 有没有办法让启动时仍然显示主屏幕,但也可以启动我的应用程序。 (I don't think I want to use a Service, because my application has UI.) (我不认为我想使用服务,因为我的应用程序具有UI。)

Decision on weather you should or should not use Service in appliction is independent on weather it has UI or not. 您是否应该在应用中使用Service的天气决定取决于它是否具有UI。 All "third party" apps have UI, there is little use of application without at least 1 activity. 所有“第三方”应用程序都具有UI,只有至少1个活动才很少使用该应用程序。

So in your case, just use Service . 因此,就您而言,只需使用Service

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM