Reputation: 11
i am beginner in android development and i develop application with activties and services . now i want to add new option which that disable application. how to stop this services
Upvotes: 1
Views: 2949
Reputation: 11875
There is no need to stop the service in normal execution. If needed the OS will do that for you.
If you Service has started any background threads then you should stop those of course. But that is done the normal Java way.
You should read Multitasking the Android Way.
Upvotes: 0
Reputation: 14738
To start the service:
startService(new Intent(ThisActivity.this, YourService.class));
To stop the service:
stopService(new Intent(ThisActivity.this, YourService.class));
They can be called from anywhere within your Activity.
Upvotes: 1