I am creating an android service using this code:
var intent = Ti.Android.createServiceIntent({ url : 'service.js' }); Ti.Android.startService(intent);As you can see, this service is started only once, it is not called in an interval every X milliseconds. Now when the application is exited (not put to background) and started up again, I would like to retrieve the reference of the service and stop it if the user clicks the stop button. Is there any way of achieving this?
Basically I am trying to achieve this: 1. app starts, there is a "start service" button present 2. click on button starts the service 3. app is closed with the back button 4. app is started up again but instead of "start service" button there is "stop service" button as the service is already running 5. click on the button stops the service
Thank you!