Android Launcher Shortcuts

对着背影说爱祢 提交于 2019-12-01 13:58:35

The problem with launchers is that they start Activities, whereas what you want is to start a Service so you can modify the app state in the background. It sounds like what you really want to do is make a Widget, not a launcher shortcut. You can configure the widget to have a button that sets off a Service that will toggle things in the background.

You can "more simply" make a hidden activity that will do what you want!

This activity must use transparent themes so it never shows and call finish() at the end of the onCreate() without any particular conditions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!