I created an android application with a foreground service that is always running. Initially, when the application is completely shut down (both process and service is not running), I try to use a broadcast to wake up the service, then my application take up 36MB of memory.
Next, I open the application and the memory usage grow up to 121MB. Finally, I tried to swipe out to kill the app, OnDestroy() method in MainActivity get called and I manually called GC.Collect() within this method, however, it's still take up 109MB of memory
My foreground service is just listening to step detector sensor and store the result to 'SharedPreferences' so I believe it won't take over hundred MB. Is there anyway to release more memory when the app is swiped out by user? Thank you.