Issue
In my app, I have an Activity from which I want to start a Service. Can anybody help me?
Solution
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:
Intent serviceIntent = new Intent();
serviceIntent.setAction("com.testApp.service.MY_SERVICE");
startService(serviceIntent);
Answered By - Pierre-Antoine LaFayette
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.