How to simulate a service killed by the Android system

丶灬走出姿态 提交于 2019-11-30 20:17:07
cdlc

if you're developing in Android Studio while you are running your application in android wear side try to hit the kill button displayed in the console.

When you hit this button all the threads + services + activities from this app will be destroyed. If your service is of type "STICKY" it will start by itself after you kill your application.

cdlc's answer works, but another way is if you're developing in Android Studio you can go to DDMS: Tools->Android->Android Device Monitor and press the stop button there and you will also see a sticky service restart.

If you check the developer options on an Android phone, there will be an option to show the running services. Under that option you can choose to stop any service that is running.

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