Adding features to local geodatabase id of new feature = -1 on iOS and Android

2807
4
04-14-2016 01:32 PM
ShaneFeirer
New Contributor III

I have built a custom version of the quick report app with the ability to store and add features offline.  It works perfectly on windows using appstudio player from within qt creator.  However when I use the appstudio player on either iOS and Android the features are not created and therefor there is nothing to sync.  I think that the app is creating the geodatabase correctly, but when I add the feature to the local geodatabase the new feature id reported by the addFeature method on the geodatabase says that the id is -1.  The path that I am defining to the local geodatabase is "~/ArcGIS/Runtime/Data/PigTest.geodatabase".  Should I be storing the local geodatabase in a different location? Any help or insight would be appreciated.

Regards,

Shane Feirer

0 Kudos
4 Replies
PaulHaakma
Regular Contributor

Hi Shane

first thing you could do is place a bit of text on the screen bound to the property of the geodatabase that says whether it is valid or not - that will help you know when you fire up on android/ios devices whether it's finding the geodatabase or not.

re defining paths, I ended up using AppFramework.userHomeFolder.path as the base under which seems to work. Not sure if there is a better practice or alternatives - if anyone knows then would be good to find out.

The test for windows is optional, just means you can place it where you want on a pc...

property string apppath: Qt.platform.os === "windows" ? "c:/examplefolder" : AppFramework.userHomeFolder.path;

property string gdbpath: apppath + "/gdb"

etc...

0 Kudos
TobiasFimpel1
Occasional Contributor III

Shane,

for local geodatabase editing the app needs to be licensed at Standard level (see here). Could this be the issue?

One quick test you could try is to run it from the AppStudio Player app (not the dev./Qt Creator edition; instead use the same Player App you test with on iOS and Android) on your Windows computer and see if it works then. Running it through AppStudio's Qt Creator sets your license level automatically at Developer I think.

0 Kudos
MichaelDavis3
Regular Contributor

This is pretty much expected behavior.  As far as I can tell data added in a checkout replica is populated with a temp ID until it is sync'd with ArcGIS Server.  Just another reason you shouldn't rely on ObjectID for anything.

0 Kudos
ShaneFeirer
New Contributor III

Thank you all for the comments.  I will give them a try and let you all know what worked.  A related question, after you declare a geodatabase {path: xxxxx} how to you undeclare the geodatabase and remove the lock that is placed on it.

0 Kudos