Some Android 100.0.0 Questions

687
2
05-15-2017 01:37 AM
LageplanGöttingen
New Contributor III

Hi,

 

I'm currently migrating my complete Android app to the new API 100.0.0.

 

I already mentioned that I am missing the Feature Selection Mode and a way of getting subtype descriptions but here are some more things I noticed:

 

  • I could no longer find a way of storing the current map state when I pause the map activity. I.e. something like "restoreState" and "retainState". This means that my map always zooms back to the inital viewpoint, not to the user's last location.
  • When I add and remove graphics dynamically, it occasionally happens that a removed graphic is still being displayed. I checked the size of the corresponding graphicsOverlay - it is empty, and the graphic cannot be selected. So maybe the graphic is cached somehow? Is there any way to refresh the graphicsOverlay to clear the cache?
  • I licensed my app, included Esri attribution in the "About" screen of my app, and I do not use an ArcGIS Online basemap. But unlike in the old API, the Esri attribution bar ("powered by Esri") is always visible (and I must say, I find it quite irritating...). Can I disable it somehow? Is it included in all license levels?

 

Otherwise, I am now almost done with the migration ...

 

Thank you,

 

Claudia

0 Kudos
2 Replies
AlexanderNohe1
Occasional Contributor III

I licensed my app, included Esri attribution in the "About" screen of my app, and I do not use an ArcGIS Online basemap. But unlike in the old API, the Esri attribution bar ("powered by Esri") is always visible (and I must say, I find it quite irritating...). Can I disable it somehow? Is it included in all license levels?

You can use MapView.setAttributionText(boolean) to determine whether that grey bar on the bottom of the mapview is visible or not:

Here is the documentation for this:

GeoView| arcgis-android 

I could no longer find a way of storing the current map state when I pause the map activity. I.e. something like "restoreState" and "retainState". This means that my map always zooms back to the inital viewpoint, not to the user's last location.

I would use MapView.getCurrentViewpoint(Viewpoint.Type) to get the viewpoint when you pause the map, following that with Viewpoint.toJson() so you can store the viewpoint in shared preferences or wherever you would like.  You can then rebuild the viewpoint by calling Viewpoint.fromJson(String) and then passing that viewpoint to your mapview object.

getCurrentViewpoint()

GeoView| arcgis-android 

toJson()

Viewpoint| arcgis-android 

When I add and remove graphics dynamically, it occasionally happens that a removed graphic is still being displayed. I checked the size of the corresponding graphicsOverlay - it is empty, and the graphic cannot be selected. So maybe the graphic is cached somehow? Is there any way to refresh the graphicsOverlay to clear the cache?

This is interesting...  I am going to have to try this and see if I can reproduce.  I have another app that I wrote where I remove graphics and they no longer display.

Hope this helps!

Alexander

LageplanGöttingen
New Contributor III

Thanks, this helped me a lot!

The bar on the bottom is invisible now and the "Viewpoint.toJSON" solution also works fine.

Now I just need to find a solution for the graphics problem. The entire workflow in my app is a bit complicated: POIs are displayed by a feature layer on top of my map to provide a general overview of their locations. If a user clicks on a POI feature which lies inside a building polygon, the POI feature layer is set invisible and instead graphics (with the same symbols and attributes as the features) are added to a graphicsOverlay for all POIs which are on the same floor in the selected building (based on a overviewLayer.getFeatureTable().queryFeaturesAsync query). Maybe the error can be found somewhere within this workflow... I will try to figure it out.

0 Kudos