Creating a service to do the work in the background and implementing a wakelock.
For the application to act as a proxy in the background we need to run it as a service. In Android there are two types of services... Background service: Counter-intuitively this is not what we are going to use since the Android system will kill the service after the user leaves the application.\
Foreground service: This service requires us to run a notification constantly. But this service will work even if the user leaves the application.\ Problem: Service gets killed if the screen is turned off.\ Solution: Implementing Android's Wakelock feature so that the Android system will not kill our service.