"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Reload Trackables on OnApplicationFocus / OnApplicationPause

Summary

I'm working on a mobile application for iOS / Android. The Background Behavior is set to suspend which means the application is send into background but is keep in memory. OnApplicationFocus and OnApplicationPause are called as soon as application enters the foreground again.

 

Goal

Reload (replace not append) all existing Trackables as soon as the application is entering the foreground.

 

Approach

Hook into OnApplicationFocus and register a callback function to reload the DataSet.

VuforiaARController.Instance.RegisterVuforiaStartedCallback(LoadDataSet);

 

LoadDataSet

Image removed.

 

Let's jump into the code and see what i'm struggling with.

 

Debug LoadDataSet

Image removed.

 

Because dataSet.Load seems to append the content of the dataset file instead of replacing already existing entities and because i could not figure out how to reload / update existing entities, i tried to delete duplicates manually.

 

Remove Duplicates

Image removed.

 

I'm probably missing something here but i don't know what :)

Any help would be greatly appreciated.

 

Open Questions

1. How to remove all entities from the current dataset (in memory) or replace it with a fresh / empty one?

2. How to remove specific entities during runtime without exceptions?

 

PS: Sorry for the images but the syntax highlighter - actually the whole WYSIWYG Editor - is really annoying

Attachment