In general we can use AppClient.getData() from the app and see latest status.
Is it possible to query the AppClient and check if the service is running?
The problem is that if the code in the service callback has a problem and can not complete correct and update the status, then every time when you check from the app you will have a status that indicates running process.
For example if we have 3 statuses (UploadImages, UploadingImages and Idle). We want to start our service and upload the images only if current status is Idle. Then we send UploadImages to our service, the service starts uploading and changes it's status to UploadingImages. At this time there could be a problem and the service may stop here, then next time when you getData from the service will receive UploadingImages. Currently this status will remain until the app is force stopped and started again, then we will have null as response.
I'm surrounding my code with try catch and trying to close the service properly if something unpredictable happens, but still if is possible from the AppClient to check if the service is running will be great
In general we can use
AppClient.getData()
from the app and see latest status. Is it possible to query the AppClient and check if the service is running?The problem is that if the code in the service callback has a problem and can not complete correct and update the status, then every time when you check from the app you will have a status that indicates running process.
For example if we have 3 statuses (UploadImages, UploadingImages and Idle). We want to start our service and upload the images only if current status is Idle. Then we send UploadImages to our service, the service starts uploading and changes it's status to UploadingImages. At this time there could be a problem and the service may stop here, then next time when you getData from the service will receive UploadingImages. Currently this status will remain until the app is force stopped and started again, then we will have null as response.
I'm surrounding my code with try catch and trying to close the service properly if something unpredictable happens, but still if is possible from the AppClient to check if the service is running will be great