i has android package update application. Sometimes we publish new android version or bug fixing packages. Then users download package and loads package. Also we publish force update and packages was downloaded and loaded. It has to communicate with server using broadcast and service.
It works properly if application runs once before. But we need some information about devices to report something. If user does not run application, Service will not work. So app does not work properly.
For this, We need our application runs as soon as android device open. So service will be active. And app works properly.
Update packages comes to our company from different companies. They should change package to start my application as soon as packages loaded?
If you're asking if you can start any services as soon as it has been downloaded, then it's impossible. How can you expect your code to run when the application is never started?
Edit:
All you can do to start the app after the device is booted is setting a receiver with an intent filter in your manifest.
You'll also need a
BroadcastReceiver
, so add this class to your source.I do not know if this will also work with updating the device, but this is all that is possible. This will popup the App when the device is booted.
I also wonder, is it really required to do this as soon as the device is updated? Couldn't you just check the Android version once the app is booted. Then save this version to the sharedPreferences. Next time you run compare the current version to the one that is stored. If it's not the same, then update you packages. This could be an alternative solution.