Local Cache
Overview
When you project cannot reach the Internet, data is written to a local file. When a session is run and internet is available, the contents of this file will automatically upload in the background. This works between sessions, so you can freely start more sessions even when offline.
Cache Size
Open Preferences from the Cognitive3D menu to change the Upload Local Cache Rate and the Cache Size. If more session data is recorded and the cache doesn't have enough space allocated, the most recent session data may be lost.
Where is the cache located?
The local data cache is in the c3dlocal
folder in Application.PersistentDataPath. This is different for each platform. This has been tested on Windows and Android.
A benefit from saving the session data to the PersistentDataPath is that this saved data will persist to newer versions of your app (or even if you uninstall your app).
When is data read from the cache?
The data from the cache is read and removed when you have an internet connection and while running the application.
Manually sending data from Local Data Cache
You can manually send data from the cache using the following code:
Cognitive3D.NetworkManager.UploadAllLocalData(
() => Debug.Log("complete"),
() => Debug.Log("failed"));
This will quickly try to upload all outstanding requests and invoke the callbacks when it is completed. This will fail if the device is offline or if Local Storage is disabled. You do not need to start a Session to call this function.
If you have a question or any feedback about our documentation please use the Intercom button (purple circle) in the lower right corner of any web page.