« Back to Cius Developer Questions

Making an application keep running in background

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hi all
 
We want to develop an application that makes scheduled updates from a web service. We are investigating an architecture that works like a windows service. And also, we want the service to be alive from the time it is being installed first time to device, without manually triggering it to run. This solution will make us to use planned timers in application and make the update on timer's tick dates.
 
What we found is, there are android services that makes ability to make an application to run for a long time. But the problem is, to start an android service, service start operation must be triggered via an android application, where android application must be started by user. This option is not suitible for us.
 
My question is, is there any structure to make a service (or android application) to run automatically on installation time? Or are there any other solution for scheduled tasks?
 
 
Edit: Is it always true that, if we install an application to our device, will the application be started on device boot? Or will the application be started after installation or update by AppHQ?  In that case, starting the service on boot_completed event will solve the issue..
 
Thanks
Ergin

Ergin,

Like your edit says the best way to make it so your application is started when the device is on would be starting the service through the on boot completed event. The only thing with this is that it won't take effect until the user restarts their device after they have installed your application to the device.

Thanks,
Matthew Williams

Hi Matthew

Thanks for your response. We are planning to solve the service start issue by adding an extra sticky event like DOCK_STATE.

For clearance, I want to repeat my question, can we always say that, if we install an application to cius by AppHQ, does it always starts automatically after the installation?

Thanks

The act of installing the app cannot be used to start that same app.  It must launch the first time either by user interaction with a manual launch or by a restart.  One possible workaround would be the listen for a common system broadcast intent to trigger first launch.

Hi David

Don't you think that this is an important deficiency for an application enviroment in general?

For example, we have several users (which are elite users of our company) using cius and now we are unable to distribute an automatically started service or application to our all cius users without requesting them to start the distributed application manually.


Ergin

My understanding is that it's a design decision by the Android OS team (i.e. upstream) that's been discussed and dispositioned previously.  As you say there are some potentially unique use-cases for the enterprise - if you'd like to provide more detailed input on the business requirement and opportunity, please give us an email at developer-support@cisco.com and we'll put you in touch with some folks who can discuss further.