I was trying to customize the Popup behavior on a new App built using ArcGIS Runtime SDK for Android 100.9, where I would like to show fileds that were hidden by default, as a custom feature.
Unfortunately I realised that listing fields from featureTable (.getFeatureTable().getFields()) or from Popup(getPopupDefinition().getFields()) gives the same result: I can only list fields that were markerd as visibile in the ArcGIS Pro project that generated the MMPK.
I haven't found away to list all fields that were originally present in map's layers, it seems that hidden fields are not reachable.
I'm probably missing somthing, but when I open the my MMPK (as a zip archive) under the "p14" folder I can find 3 kind of files:
- .geodatabase file for each map with operational layers: SQlite spatially enabled for use as mobile gdb -> those fields that were hidden in MMPK are present there (so data is preserved while creating MMPK even for hidden fields)
- .mapx file for each map : JSON describing the Map itself where the fields are all present, with different visibility default, same as original mapx as expecceted.
- .mmap file file for each map: JSON describing (If I guess right ...) how the map should be read by a Runtime SDK client, a sort of Offline version of the webmap of the Online WebGIS pattern.
Well, in the .mmap files, hidden fields were completely missing!
All fields are described by a JSON object with a visibility attribute, but the JSON objects, describing the hidden fields, are not present inside the file. If the SDK reads fields from this .mmap files, well I guess there is no way to get the list of all fields (visibile and hidden)
I hope I'm missing some precondition or implementation tha can be used.
If anyone that has found a solution on this task, any hint is very apprecaited.
FeatureTable fields (getFeatureTable().getFields()) are returned by the layer's definition which is generated at the time of authoring the mobilemappackage. You can find it in the SQLite geodatabase under `p14` folder. It should be present in the `ItemInfo` column of the `GDB_ServiceItems` table within the geodatabase. Since those fields are hidden while authoring, they do not constitute as Fields in the service definition.
For your scenario where you want to show limited fields to begin with in Popup and then show the other fields as custom feature. You should be able to configure Popup with a default set of the Fields (all visible) while authoring and then through Runtime code you can override the PopupDefinition (FeatureTable.setPopupDefinition)of the FeatureTable whenever you want to change them to a different set of Fields.
thanks you for your suggestion (and sorry for late replay, I had some issue with duplicate accounts)
So as you confirm, by now the only way to have a customization on field visibility is to implement a "logic layer" similar to Webmap popup on the Application, eventually persisting user choices on the device as json, as default visibility can only be chosen during ArcGIS Pro authoring.
If I mark a field as invisible on ArcGIS Pro, it stays invisible, right?
I have a last doubt, that you can confirm. Are invisible fields copied with all its data in the SQLite?
I was expecting that invisible fields could be a way to save disk space (important for mobile device) leaving half of the fields invisible (less important for Field worker user). I made just a fast compare with 2 MMPKs files and the size of the one with all fields visible was the same of an MMPK with all invisible fields, so I guess they are all copied in the MMPK. Am I right?
I think that MMPK Authoring or SDK can improve by this point of view as Popup customization and disk space are 2 key factor for mobile users to help them reach information they need in a easier way.
Is there anything on the roadmap about this topic?
Anyway I hope to find soon time to implement what you suggested as to mark it as a possible Solution!
I have a last doubt, that you can confirm. Are invisible fields copied with all its data in the SQLite
Yes, all the fields are copied in the SQLite.
I think that MMPK Authoring or SDK can improve by this point of view as Popup customization and disk space are 2 key factor for mobile users
They might not go hand in hand, but independently disk space can be a factor. For popup customization we may need all the fields and its data (since this is all offline content)