WVR_ImportPersistedSpatialAnchor¶
-
WVR_EXPORT WVR_Result WVR_ImportPersistedSpatialAnchor(uint32_t dataCount, const char * data)
Function is used to import the persisted anchor related data.
Note that this API operation can be time-consuming, so it’s recommended to avoid performing it on the main thread and render thread.
- Version
- API Level 14
- Parameters
dataCount
: the data size that data allocateddata
: the data which is exported by WVR_ExportPersistedSpatialAnchor API
- Return Value
WVR_Success
: Import the data successfully.others
: WVR_Result mean failure.
How to use¶
Sample function:
// do this before
WVR_SpatialAnchorName persistedName = {"uniquePersistedName"};
uint32_t output = 0;
if (WVR_ExportPersistedSpatialAnchor(&persistedName, 0, &output, nullptr)) == WVR_Success) {
char* data = new char[output];
if (WVR_ExportPersistedSpatialAnchor(&persistedName, output, &output, data)) == WVR_Success) {
// the data will be filled by runtime
}
}
if (WVR_ImportPersistedSpatialAnchor(output, data)) == WVR_Success) {
// import the data to runtime successfully
}