Android – Does GC collect my outer class if the inner class is a service?

I’m currently developing an app for android that has a “Service helper” class so I can target multiple API-s without having to write the “API chooser” code every time I use a Service.

The structure is

  • Outer class is not a Service (extends Object)
  • Inner class #1 is derived from JobService, and targets API 21+
  • Inner class #2 is derived from IntentService and targets lower API levels

The outer class is responsible for holding data required by the services and scheduling the services. The question is: if the activity that created an instance of the outer class gets destroyed by the time the service starts, will GC collect the outer class? (I don’t hold a reference to it in any of the inner classes apart from OuterClass.this)