Android Anti-Kill
Now the cleanup software, such as 360 has a key to clean up the function, he will run in the background of the program to kill off. The program does not go through a normal life cycle after it dies, such as calling the Ondestory method. How can the program keep running in the background without being killed by 360?
After testing several methods, we finally found a way. Android has a sync tool, Sync Adapter, which you can run periodically after registering. This way, even if your process is killed, it will automatically restart within a certain amount of time. The Android develop website has his introduction to Run the Sync Adapter periodically
You can download the official example to see how he declared the registration of the Addperiodicsync method is to add the method of cycle run
1 Long pollfrequency)
Pollfrequency is the time of the cycle, which is measured in seconds.
However, during the actual testing process, it is not necessarily the time you write, sometimes fast or slow, that is because
Although these sync is scheduled at the specified frequency, it could take longer for it to actually is started if other Sy NCS is ahead of it in the sync operation queue. This means, the actual start time may drift.
Your synchronizer will be affected by someone else's Synchronizer.
Android Anti-Kill