Worker.Result receiveDownload(final Context context, final NotificationManagerCompat notificationManager, final NotificationCompat.Builder notification, final Runnable updateForegroundNotification,
                         final Uri uri, final String preset, final String sourceURL, final long sourceDate, final int offlineMapTypeId) {
        this.uri = uri;
        this.filename = preset;
        this.sourceURL = sourceURL;
        this.sourceDate = sourceDate;
        this.offlineMapTypeId = offlineMapTypeId;
        this.downloader = Download.DownloadType.getInstance(offlineMapTypeId);
        if (downloader == null) {
            return Worker.Result.failure();
        }

        final boolean mapDirIsReady = ContentStorage.get().ensureFolder(downloader.targetFolder);

        if (mapDirIsReady) {
            // test if ZIP file received
            try (BufferedInputStream bis = new BufferedInputStream(context.getContentResolver().openInputStream(uri));
                 ZipInputStream zis = new ZipInputStream(bis)) {
                ZipEntry ze;
                while ((ze = zis.getNextEntry()) != null) {
                    String filename = ze.getName();
                    final int posExt = filename.lastIndexOf('.');
                    if (posExt != -1 && ((StringUtils.equalsIgnoreCase(FileUtils.MAP_FILE_EXTENSION, filename.substring(posExt))) || (StringUtils.equalsIgnoreCase(HILLSHADING_TILE_FILEEXTENSION, filename.substring(posExt))))) {
                        filename = downloader.toVisibleFilename(filename);
                        // found map file within zip
                        if (guessFilename(filename)) {
                            return handleMapFile(context, notificationManager, notification, updateForegroundNotification, true, ze.getName());
                        }
                    }
                }
            } catch (IOException | SecurityException e) {
                // ignore ZIP errors
            }
            // if no ZIP file: continue with copying the file
            if (guessFilename(preset)) {
                return handleMapFile(context, notificationManager, notification, updateForegroundNotification, false, null);
            }
        } else {
            notificationManager.notify(Settings.getUniqueNotificationId(), Notifications.createTextContentNotification(
                    context, NotificationChannels.DOWNLOADER_RESULT_NOTIFICATION, R.string.receivedownload_intenttitle, String.format(context.getString(R.string.downloadmap_target_not_writable), downloader.targetFolder)
            ).build());
        }
        return Worker.Result.failure();
    }
receives a file downloaded with system's DownloadManager, copying it to the appropriate c:geo folder
called internally by {@link ReceiveDownloadService} or {@link ReceiveDownloadWorker}
main/src/main/java/cgeo/geocaching/downloader/ReceiveDownload.java