Select to view content in your preferred language

Accessing offline map after website migration

268
2
10-01-2024 07:09 AM
Labels (1)
NijuJayakumar
New Contributor

I have been using Oflline map in my Application. After the migration to new web portal am able to create new webmap and offline region but sharing options are only (Owner , Organization).

In the application am trying to load my offline area but it always return empty list. I am setting a API int the global context.

 

 

ArcGISPortal portal = await ArcGISPortal.CreateAsync();

PortalItem webMapItem = await PortalItem.CreateAsync(portal, PortalItemId);

_originalMap = new Esri.ArcGISRuntime.Mapping.Map(webMapItem);
for the web map item.
_offlineMapTask = await OfflineMapTask.CreateAsync(webMapItem);

IReadOnlyList<PreplannedMapArea> preplannedAreas = await _offlineMapTask.GetPreplannedMapAreasAsync(); // returns empty list

 

 

currently my plan is lite with pay as you go. do i need to update my plan to have access or i am missing some permissions.

0 Kudos
2 Replies
pnarkhede
Esri Contributor

Thanks for reaching out with your query.

Although the question could benefit from more details, I'll do my best to assist you with troubleshooting.

Troubleshooting Steps

  1. Double-check all sharing settings for the web map and its layers in ArcGIS Online.
  2. Verify that offline map areas have been successfully created for the web map.
  3. Confirm that the offline areas are visible and accessible on ArcGIS Online.
  4. If possible, test the offline functionality in other ArcGIS products to isolate whether the issue is specific to your application or a general problem with the web map.

Typically, if there are licensing limitations, an exception will be thrown. You might also consider running your application in developer mode, which enables all features, to see if this resolves the issue.

0 Kudos
NijuJayakumar
New Contributor

Thank you for your Reply.

I have cross checked all the settings.

  • Webmapitem is offline enabled
  • Offline are is successfully created

I have tested with setting API key globally (App.xaml.cs).

I have also tried to authentificate with clientID and Secret. i used the following code for user authentification (code is taken from the example).

        public static void SetChallengeHandler()
        {
            // Define the server information for ArcGIS Online
            ServerInfo portalServerInfo = new ServerInfo(new Uri(ArcGISOnlineUrl))
            {
               
                OAuthClientInfo = new OAuthClientInfo(AppClientId, new Uri(OAuthRedirectUrl))
            };

            // If a client secret has been configured, set the authentication type to OAuth client credentials.
            if (!string.IsNullOrEmpty(ClientSecret))
            {
                // If a client secret is specified then use the TokenAuthenticationType.OAuthClientCredentials type.
                portalServerInfo.TokenAuthenticationType = TokenAuthenticationType.OAuthClientCredentials;
                portalServerInfo.OAuthClientInfo.ClientSecret = ClientSecret;
            }

            // Register this server with AuthenticationManager.
            AuthenticationManager.Current.RegisterServer(portalServerInfo);

            // Use a function in this class to challenge for credentials.
            AuthenticationManager.Current.ChallengeHandler = new ChallengeHandler(PromptCredentialAsync);

        }

 

0 Kudos