tags:

views:

173

answers:

3

In my app i have an activity from which i want to start an Service Can any body help me?

+1  A: 

The API Demos have some examples that launch services.

jleedev
+1  A: 

Use a Context.startService() method.

And read this.

Yeti
+2  A: 

The application can start the service with the help of the Context.startService method. The method will call the onCreate method of the service if service is not already created; else onStart method will be called. Here is the code to start the MyService:

Intent serviceIntent = new Intent();
serviceIntent.setAction("com.testApp.service.MY_SERVICE");
startService(serviceIntent);
Pierre-Antoine LaFayette