Monitoring API's from web site in the background

I created an apk in MIT app inventor that monitors a couple of web site’s API’s and then processes the information from those site with my own algorithms. Then I chart the outcome for the user to study the pattern of behavior.
My frustration is that I just discovered that I can’t have the APK running in the background. It stops when it goes out of scope.
Is there any easy way, short of using keep screen in the foreground, way to make it work when it is in the background. May be some extension?


I just answered your question here