I am trying to bundle my data as a resource for deployment in an iOS application. The relevant code below writes the .geodatabase to C:/Users/username/ArcGIS/Runtime/Data on my local machine and AppPlayer renders the featureLayers correctly. However, it does not work in the iOS AppPlayer, nor does it work in the deployed iOS application after a Cloud Make. I do see a folder in the Documents of the installed iOS application named myData.geodatabase but is 'zero KB'. I have tried replacing this with a copy of the myData.geodatabase but this apparently is not the correct path to the data as the app still does not render the featureLayers.
Any insight would be greatly appreciated.
PW
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import ArcGIS.AppFramework.Runtime 1.0
import ArcGIS.AppFramework.Runtime.Controls 1.0
import ArcGIS.AppFramework.Runtime.Dialogs 1.0
property string runtimePath: AppFramework.userHomeFolder.filePath("ArcGIS/Runtime"
property string dataPath: runtimePath + "/Data"
property string inputGeodatabase: "myData.geodatabase"
property string outputGeodatabase: dataPath + "/" + inputGeodatabase
Geodatabase {
id: attachmentGdb
path: copyLocalData(inputGeodatabase)
onValidChanged: {
if (valid) {
var gdbtables = gdb.geodatabaseFeatureTables;
for(var i in gdbtables) {
console.log (gdbtables[i].tableName);
}
}
}
}
function copyLocalData(dataPath) {
AppFramework.userHomeFolder.makePath(dataPath);
resourceFolder.copyFile(inputGeodatabase, outputGeodatabase);
return outputGeodatabase
}
/*
Copy the data to the Runtime folder... Note the use of the ":/qml" prefix. AppStudio project files are packaged in a resource file named qml.qrc with a prefix of "qml"
*/
FileFolder {
id: resourceFolder
path: AppFramework.player === null ? ":/qml" : "./"
}
Hi Patrick,
Can you please try if your app works with the below copyLocalData function.
App { id: app width: 640 height: 480 function copyLocalData() { AppFramework.userHomeFolder.makePath("ArcGIS/Runtime/Data"); app.folder.copyFile(inputGeodatabase, outputGeodatabase); return outputGeodatabase } }
The root object of all AppStudio apps is the App object. It contains a property called folder which is the current app's folder path. app.folder works both in AppPlayer and stand alone apps built with Cloud Make.
Hi,
on Android (and Windows7, and it should be everywhere) I've manged the right path for data with help of
app.settings.value
function. I can't find online help, but settings is property of App object from AppStudio Framework.
This settings is read from json file, which is on Android on <device specifik>/ArcGIS/AppStudio/Settings/<app_id>.json
app_id hash string can be found in iteminfo.json in the folder of the app with key id.
So my code in app looks like:
Geodatabase { id: localData path: app.settings.value("gdbData") }
where "gdbData" is the key in my setting json.