Syncing geopackage from QGIS causing issues on Qfield App

Hello, new member, first time question.

I have created a QGIS project and uploaded to to QField Cloud, I then down load the project to QField (on mobile) and then start to add records, everything works as expected. I then sync the data back up to QGIS and I see the new records. I then delete one of the records in QGIS and then push the edited geopackage back up to QFieldcloud. I then remove the project from QField (remove stored project), refresh the project list then download the project again. When I open the project everything is as expected, the deleted record has been removed. However, when I try and add a new record although it reports ‘changes saved’ it does not registers as a ‘push’ change ( no blue dot) and I am unable to push the new record.

I understand that you cannot change the structure of the geopackage but I am just editing the record/attributes in the geopackage, is this expected behaviour?

Looking forward to any insight you may be able to provide.

Thanks.

what do you mean by “I then remove the app from QField"? I think it is just a typo, but in any case you don’t usually need to delete anything when trying to get the changes from the desktop to the mobile device.

Oops, yep sorry , meant remove the project from the qfieldcloud project list (so I can redownload the project to the app - remove stored project) - edited in original post

Ohh ok. But if you don’t delete the project first, does everything work ok? I’m not sure this is an expected workflow, so maybe it’s not properly deleting everything.

If you are on android, you can plug your device via usb to check in your pc if, after deleting the project, you still have some files on the folder where qfield stores the projects on your android. I believe it’s in <drive>:/Android/data/ch.opengis.qfield/files/Imported Projects or something like it.

Thanks Cuprico, I am on an iphone.If I don’t remove the project I don’t see how the edited geopackage can be sent to the phone, maybe I should try synchronising the project instead.

Are you trying to transfer only the geopackage without a project? Otherwise, yes, to get the updated geopackage (even while having the project open on your phone), you have to do a full synchronisation from inside the app; that would both push your local changes and download the changes you’re missing from the server.

What you can’t do is make changes on the phone, upload them, then make changes on qgis without first synchronising with the cloud, upload the project and finally re-synchronise on your phone. In that specific order, all the changes that the desktop qgis “missed” are lost. So before making changes on the desktop, make sure you have downloaded the last version from the cloud.

Same result with synchronising unfortunately. It seems that any editing of a geopackage in qgis once downloaded from qfieldcloud causes this issue if you push the edited geopackage back up to qfieldcloud. Some googling resulted in some saying any altering of the geopackage affects the management of the primary key which results in QField not recognising the change and failing to generate a push notification.

Hmm, keep in mind that the qfield sync plugin always tries to make a new copy of your qgis project on a different folder (typically on the <user folder>/QField/cloud/ directory). From the moment you create this folder and project on the qfieldcloud platform, you should use that one instead, not the original. Maybe you are “recreating” the project by trying to upload your original project instead of the new one created by the qfield sync plugin.

Yep, can confirm that I am syncing the right project.

I work all the time with geopackages, editing back and forth between qgis and qfield (only deleting or adding features, not modifying the structure of the file), never had a problem, so that thing about the management of the primary key sounds like it might be a different issue. Maybe try with a new, clean project with a different name (to make sure it doesn’t try to use the same folder on your phone for the old project) and only use the synchronise function, without trying to delete anything first.

Thanks for your time Cuprico, appreciate it. Good to know that you should be able to edit and resync the geopackage back to qfield, that helps. I will try what you suggest and see how I go. Start simple with a few attributes and progress in small steps, will post back with any updates.

1 Like