Select to view content in your preferred language

CreateCache from mobile Service, Feature Layers are null

671
1
08-06-2010 10:02 AM
RyanBates
Emerging Contributor
We have published a mobile map service with 2 feature layers, When we look at the service via the web browser and look at the services folder we can see the available service with the 2 layers, but when I use the following code the MapCache object's Layers and FeatureLayers remain null. When we do the same thing but with the sample map cache the layers and featureLayers are present.

Can anybody point me in the right direction as to why the layers are not coming in?
Are feature layers are empty (Is that are problem?) we want to add points via the mobile app and the sync those changes back to the server.

Here is the code (simplified for this posting):

_mobileServiceCache = new MobileCache(@"\Temp\ServiceCache");
mobileServiceConnection1.Url = @"http://<ourserver>.com/ArcGIS/services/FieldLayout/Map1/MapServer/MobileServer";
mobileServiceConnection1.CreateCache(_mobileServiceCache);
_mobileServiceCache.Open();

var agent = new MobileCacheSyncAgent(_mobileServiceCache, mobileServiceConnection1);
agent.DownloadExtent(_mobileServiceCache.GetExtent(), 0, 0);
map1.DataSources.Add(_mobileServiceCache);


now the _mobileServiceCache.Layers and FeatureLayers are null.
0 Kudos
1 Reply
RyanBates
Emerging Contributor
So I will answer my own thread to prove how dumb you can be.... The problem was that I had two mobileCache variables and do to a copy paste error I was looking at the mobileCache that had not yet been initialized therefore the layers were null. Yes I guess I am that dumb, but at least I caught my own stupidity instead of getting it pointed out to me...
0 Kudos