At first, I didn't call RemoveAllViews(). It was just a try, after I discovered the Problem (I found it in another thread in this Forum ... I hoped, to remove the app from Memory quicker...). I removed it, but it still has no effect:
Code:
StartServiceAt("Starter", DateTime.Now + Global.Service_Intervall*1000, False)
Activity.Finish
Up to now, couldn't see the "application not responding" Dialog. It's only a black Screen.
But today in the morning, I just see a new Detail:
Yesterday in the evening, I didn't Close my app on the mobile Phone - I left it with the black Screen. Today in the morning, after unlocking the mobile phone, the black Screen was replaced by the correct Screen. The timestamp (I print the current time in a Label on the Activity) was just from now. So it seems, that Android killed the process over the night and today morning, it started the app from itself?!
So I clicked the button and the Screen disappears (as planned). 10 seconds later, the app was recalled (because of StartServiceAt()) but black again. 5 minutes later, the black Screen was replace by the correct Screen, but I couldn't press the button - the app was freezed. A few seconds later, the "Application not responding" Dialog appears and my app was black again.
Very strange! Maybe a bug in Android (I'm using a Samsung Mini S4, Android 4.4.2)?
@Erel: "you" wrote in B4A for the StartActivity-Instruction(), that we shouldn't call it from a Service. What do you recommend? What's the correct way? Maybe this is the Problem? Or: why shouldn't I call StartActivity from Service?