Q:

File Observer works in Debug Mode, but events won't trigger without debugger

I have a class that works as a recursive fileobserver. What it does is makes a file observer for all of the directories in a parent directory and then starts watching them. I know it works because when in debug mode, it logs all of the file changes in logcat. But when I disconnect from the debugger and restart the app, it makes the Started and Set Up logs but it doesn't catch any file changes. Is it possible that the garbage collector is cleaning up because the debugger isn't live and watching? I don't think that's true because the Intentservice that runs it never dies.
EDIT: I changed the intentservice to a nonstopintentservice and the same thing is still happening. So the service is not getting destroyed.
What do you think?
Thanks

A:

It turns out that even though the debugger was listing the intent service as still alive, it really wasn't and the file observers were being finalized. So I wrote a thread to fool the garbage collector into letting the objects exist.

