There is a call to OnDestroy() method in my activity. However, after that, I can still see there is something happening in destroyed activity. E.g. when I add this code to OnCreate:
Task.Run(async () => {
while (true) {
System.Diagnostics.Debug.WriteLine("PING");
await Task.Delay(1000);
}
});
then I can see PING string in Output console even after OnDestroy was called.
When I launch my activity again, then I can see PING string to be printed twice. After another OnDestroy and activity relaunch, there are 3 PING prints every second.
What is happening here?