Does anyone know what I'm overlooking. In the main app have (I only show the relevant code)
function onStart(state as Dictionary?) as Void { } this is empty
function onStop(state as Dictionary?) as Void {
if (inBackground == false){
setBackgroundEvent();} }
function getInitialView() as Array<Views or InputDelegates>? {
Background.deleteActivityCompletedEvent(); }
(:background)
public function setBackgroundEvent() as Void {
System.println("setBackgroundEvent");
Background.registerForActivityCompletedEvent();
}
(:background)
public function getServiceDelegate() as Array<ServiceDelegate> {
return [new $.BackgroundServiceDelegate()] as Array<ServiceDelegate>;
}
But still after completing the activity in with the main app open the background event triggers. The deleteActivityCompletedEvent should have been executed.
Is the problem that the saving and stopping of the main app is slower than the registerForActivityCompletedEvent(); so it still triggers? Could I Prevent this from happening ?