Tyrant > [Building adKandi.com]
One of the very small but powerful components of adKandi is “Tyrant”. So named because, well, it is a tyrant.
The idea behind tyrant is to give adKandi a 99.999% runtime on devices running it.
Building Tyrant, a list of desirable properties were made:
- Restart adKandi if for any reason, she gets terminated.
- Always force adKandi into being the only visible foreground app.
- Start adKandi on device start up.
So, how to achieve this?
- Restart adKandi if for any reason she gets terminated: A thread exception handler and a process monitoring engine [another decoupled module] are used in this case, if and when adKandi gets terminated (Either by the user or the OS). An intelligent system is built into place to detect each case and act accordingly.
- Forcing adKandi into being the visible foreground application is done by the process monitoring engine, this checks intermittently [Powered by an AlarmManager] if adKandi is the currently running app in the foreground, if she isn’t, the P.M.E starts adKandi as appropriate.
- Starting adKandi on startup is quite easy, this is done using the BroadcastReceiver that listens for boot events, on boot, the T.E.H and the P.M.E get initiated.
Ok, I am willing to answer questions if you have any.
I would be sharing disconnected code segments in a demo app later on once I get around to it and they give me permission, else, we can always talk. :)
Interesting problems? Don’t worry, I am field agnostic and I can be reached on https://21.co/fdamilola.