I have three activities in my app and all those activities requires access to service. So if i start the service three times will it be started three times or only once. And if once will the previous data be erased when service is restarted.
Thanx
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
if you are starting service with
startServicethen for first time it’sonCreatemethod will be called and it does not matter how many times you have started the service but its methodonStartCommand(Intent, int, int)will be called with respect to your startService call. Service stops when you callstopServiceirrespective of how many times you have calledstartService.Don’t forget to release the resources, threads when you stop the servive.
you can refer this doc:
http://developer.android.com/reference/android/app/Service.html