Select to view content in your preferred language

Problem refreshing FeatureLayer on android device after changes made in REST server

910
5
05-16-2012 04:03 AM
AleksiMajander
Emerging Contributor
Hi,

I have problem with refreshing FeatureLayers on my android application (uses 2 base maps as TiledMap and 3 FeatureLayers) I can load the FeatureLayers without problem, but if there are changes made on the server (ie. adding or removing features from layers). Zooming, moving or other wont help either

Only way to update the featurelayers is to remove all the featurelayers from the MapView and add them again from the server. This is way too slow for my application.

Code that i would like to get working:
 for (ArcGISFeatureLayer l : targetlayers) {
   l.refresh();
  }


I have tried to work with MODE.ONDEMAND and MODE.SNAPSHOT, neither of them seem to bring solution.
0 Kudos
5 Replies
AndyGup
Esri Regular Contributor
Aleksi, can you clarify what the problem is? Typically if there is problem it will show up in Logcat when the app is loading/running.

-Andy
0 Kudos
AleksiMajander
Emerging Contributor
Lets try to clarify

I have my phone with the mobile application (2 feature layers and base map). I also have a REST server that has software that allows me to add and delete features from these layers. Now when i use my server software to add a new feature, or to delete an old one, it wont show on my phone unless i restart the mobile application.
0 Kudos
AndyGup
Esri Regular Contributor
Aleksi, are you able to verify if there is a request/response when the refresh() method runs? And, did any errors show up in Logcat when the refresh() runs?

If you don't know how to monitor HTTP requests for native Android apps, here's a blog post that should help: http://www.andygup.net/?p=695

-Andy
0 Kudos
AndyGup
Esri Regular Contributor
Aleksi, another suggestion for HTTP responses. A real quick way to verify if the request is being made is if you have access to your web server logs then run the refresh() and see if the HTTP request shows up in the log.

-Andy
0 Kudos
AleksiMajander
Emerging Contributor
Found a workaround by setting .setAutoRefreshOnExpiration(true); and .setExpirationInterval(3);

Seems the problem is with caching the features when they are loaded from server.
0 Kudos