Main module should always exist. Can you post the exact error that you encounter when calling IsPaused.
Hello Erel,
I should emphasize that
this is a specialized case that
occurs only when I kill the app with Advanced Task Killer --
but in that task killers of one kind or another are widely
used, I felt I should handle it, regardless.
The general scenario lays out like this...
1.)
The app is running, and I kill it with Advanced Task Killer.
But the notification service remains running and displayed
in the notification area indefinitely, as though the app were
still running.
2.)
Initially, to combat that, I tested on IsPaused(Main) from
a timer sub. But when the test checked IsPaused(Main),
the OS would throw a non-specific error that basically
says nothing more than that the app closed unexpectedly.
I therefore (perhaps incorrectly?) assumed that Main was
no longer running --
but the service was.
3.)
That led me to the try-catch in a timer sub as shown above,
which successfully closes the notification without error.
Erel, I'm not sufficiently knowledgeable to say why
a service might remain when the app is killed by a task
killer; nor even if I am correctly interpreting what I am seeing.
The only other approach [which I would normally use in other
operating systems] might be to kill the service via an
On_Before_Close event -- but I'm unaware of a way to do
that in Android. Is there one...?
Always best,
David
-----
David Sosnowski
The Music of David Sosnowski