引导设备后自动启动服务,甚至应用未打开.安卓 [英] Auto Start Service after booting device even app not opened atonce. Android

查看:162
本文介绍了引导设备后自动启动服务,甚至应用未打开.安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作系统应用程序.因此,我的要求是在引导加载后运行服务,而无需一次对应用程序进行任何时间限制. 这个问题有点与此类似 系统应用自动启动 但是它没有任何适当的解决方案. 另请注意,BOOT_COMPLETE_RECEIVER仅在应用程序一次启动时有效.

I am making a system app. In that I have a requirement is to run a service after boot load WITHOUT A SINGLE TIME LUNCHING THE APP. this question is bit similar to this System App auto starting But it does not have any appropriate solution. Also read that BOOT_COMPLETE_RECEIVER works only when app launched at once.

推荐答案

感谢您的辛劳,我终于得到了答案. 解决方案: 正如我所说的,我的应用程序是系统应用程序,即使它们没有立即打开,系统也可以正常工作.因为它们未处于停止状态,即在android 3.1之后执行.

Thanks all for your effort, I finally got answer. Solution: As I stated my app is system app, System work even they not opened at once. Because they are not in stopped state i.e enforce after android 3.1.

第二,如果用户应用需要此应用,则其清单中的活动中没有任何"android.intent.category.LAUNCHER"类别.

Secondly If a user app wants this then Its manifest don't have any "android.intent.category.LAUNCHER" category in activity.

也可以通过adb使用此命令启用您的应用 adb shell广播-com.example.demo.action.LAUNCH --include-stopped-packages(未经测试)

Also by adb you can enable your app by using this command adb shell am broadcast -a com.example.demo.action.LAUNCH --include-stopped-packages (This is not tested)

与此相关的一些很好的链接: http://droidyue .com/blog/2014/01/04/package-stop-state-since-android-3-dot-1/ 从ADB安装后静态广播接收器无法正常工作

Some good link to this: http://droidyue.com/blog/2014/01/04/package-stop-state-since-android-3-dot-1/ Static BroadcastReceiver not Working after Installation from ADB

这篇关于引导设备后自动启动服务,甚至应用未打开.安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆