Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate a service killed by the Android system

While developing I wanted to test the situation where the system kills a service. This is because I'm loosing connection when communicating between the Android Wear and the handheld. And I think that it is related with the system killing some services.

Does anyone have a suggestion on how to approach this?

like image 540
Fábio Carballo Avatar asked Nov 02 '15 13:11

Fábio Carballo


People also ask

Which method is called when app is killed Android?

When Android decides to kill our app, our activities will call onDestroy method.

How do you run the service even after killing the application in Android?

If your Service is started by your app then actually your service is running on main process. so when app is killed service will also be stopped. So what you can do is, send broadcast from onTaskRemoved method of your service as follows: Intent intent = new Intent("com.

What are the requirements to kill an app in an emulator?

Go to DDMS and select your App process. Click STOP icon in upper-right-hand side. It will kill the process. Save this answer.

What is Android system service app?

System services are pre-installed software and they support core system functionality.


1 Answers

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.

Kill app button

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.

like image 171
cdlc Avatar answered Sep 28 '22 07:09

cdlc