Search code examples
androidloaddatasetmetadatavuforia

Vuforia - Load DataSet from Internal Storage


I use Quallcomm's Vuforia for Android to Image Recognition. I do download .dat and .xml files from a JSON webservice to internal storage that has a path like this;

 public void run() {
     File root = android.os.Environment.getExternalStorageDirectory();               
        File dir = new File (root.getAbsolutePath() + "/AveaEtiket/"); 
                     if(dir.exists()==false) {
                          dir.mkdirs();
                             }

And i want to load these files from internal storage instead of files that exists in assets folder . Is there anyone familiar with this situation?

Thanks.


Solution

  • Vuforia offers you different constants to specify the source to read the marker files from:

    int markerDataFileStorageType;
    markerDataFileStorageType = DataSet.STORAGE_TYPE.STORAGE_APP;
    markerDataFileStorageType = DataSet.STORAGE_TYPE.STORAGE_APPRESOURCE;
    markerDataFileStorageType = DataSet.STORAGE_TYPE.STORAGE_ABSOLUTE;
    if (!dataSet.load(MARKER_FILE, markerDataFileStorageType)) {
    ...
    

    Of course, for the absolute storage type, you need to provide the full file path.

    Each storage type represents the following:

    DataSet.STORAGE_TYPE.STORAGE_APP          -> INTERNAL or EXTERNAL storages
    DataSet.STORAGE_TYPE.STORAGE_APPRESOURCE  -> ASSETS
    DataSet.STORAGE_TYPE.STORAGE_ABSOLUTE     -> ABSOLUTE path