WVR_ExportPersistedSpatialAnchor

WVR_EXPORT WVR_Result WVR_ExportPersistedSpatialAnchor(const WVR_SpatialAnchorName * persistedSpatialAnchorName, uint32_t dataCapacityInput, uint32_t * dataCountOutput, char * data)

Function is used to export the persisted anchor related data. The exported data can be imported later by developers.

This is two calls API. Developers should call this API with the value of dataCapacityInput equals to 0 to retrieve the size of data from dataCountOutput. Then developers allocate the size of data and assign the dataCapacityInput and call the API in the second time. Then runtime will fill the 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
  • persistedSpatialAnchorName: persisted anchor name
  • dataCapacityInput: the capacity of the data, or 0 to indicate a request to retrieve the required capacity.
  • dataCountOutput: a pointer to the count of data written, or a pointer to the required capacity in the case that dataCapacityInput is insufficient.
  • data: the buffer that will be filled by runtime, but can be NULL if dataCapacityInput is 0.
Return Value
  • WVR_Success: Export the input spacial anchor data successfully.
  • others: WVR_Result mean failure.

How to use

Sample function:

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
    }
}