AnsweredAssumed Answered

Does ArcGISDownloadRequest require Admin credentials? Really?

Question asked by Crittermap on Jul 6, 2018
Latest reply on Jul 13, 2018 by ebader-esristaff

I set up a Level 1 user that is a viewer.

 

The following code failed if I used those credentials in code or when prompted.

It only worked with admin credentials.

 

The same url will download immediately, no delays, no prompt, no authentication, if I paste it directly into a browser. It seems inconsistent that it would need need admin credentials.

 

Since posting this, I tried it with a regular DownloadManager.Request. It worked, with less code and no authentication Which makes sense if it loaded in a browser. Maybe that is the solution.

 

Preplanned Workflow is broken: BUG-000114625, which is why I don't use it.



private void
downloadthroughDownloadManager() {

    String url = "https://www.arcgis.com/sharing/rest/content/items/3f791a6c3a02475181743c24406904ab/data";

    ListenableFuture<ArcGISDownloadRequest> urlfuture = ArcGISDownloadRequest.createInstanceAsync(url);//, new UserCredential("...","..."));

    urlfuture.addDoneListener(new Runnable() {
        @Override
        public void run() {
            if(urlfuture.isDone()) {
                try {
                    Date time = Calendar.getInstance().getTime();
                    ArcGISDownloadRequest request = urlfuture.get();

                    DownloadManager manager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
                    request.setDestinationInExternalFilesDir(getBaseContext(),null,"downloads/cntr" + time.getTime() + ".vtpk");
                    request.setDescription("Downloading map portion");
                    request.setTitle("BackCountry World");
                    request.setVisibleInDownloadsUi(true);
                    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE);
                    manager.enqueue(request);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } catch (ExecutionException e) {
                    e.printStackTrace();
                }


            }
            else
            {
                Log.e(TAG,"CreateDownloadRequest Failed");
            }
        }
    });



}

Outcomes