Android 没有ui的后台应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3370659/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Background application without ui
提问by Mudassir
I am new to android development. I want to make one background application, so that it keeps running in background, and it's without any UI, and even its icon do not appear on desktop.
In short it's a stealth application.
Is it possible?
我是安卓开发的新手。我想制作一个后台应用程序,让它一直在后台运行,而且它没有任何用户界面,甚至它的图标也不会出现在桌面上。简而言之,它是一个隐形应用程序。
是否可以?
回答by Josef Pfleger
This is certainly possible. To create an app that does not have an icon in the launch pad, just remove the Activity
with the android.intent.category.LAUNCHER
category from the AndroidManifest.xml
.
这当然是可能的。要创建不具有发射台的图标的应用程序,只是删除Activity
与android.intent.category.LAUNCHER
从类别AndroidManifest.xml
。
To implement your background applicationit strongly depends on what you want to do. You can create a Service
for long running tasks, BroadcastReceiver
s to react to specific events or Activities
with intent filters.
要实现您的后台应用程序,它在很大程度上取决于您想要做什么。您可以Service
为长时间运行的任务创建BroadcastReceiver
s 以响应特定事件或 Activities
使用意图过滤器。
Be aware, however, that your application will be visible in both the file system and in the settings under 'Manage Applications'.
但是请注意,您的应用程序将在文件系统和“管理应用程序”下的设置中可见。
回答by Pentium10
Yeah it's possible look up Service
是的,可以查询服务
Read more about the service in tutorials
在教程中阅读有关该服务的更多信息
ServicesDemo - Using Android Services