Сохранение и чтение файла на другом телефоне

Я загружаю изображение по url и сохраняю его во внутреннюю среду приложения. На моем телефоне все работает хорошо. Файл создается, я даже путь к нему могу получить (/data/user/0/com.helliam.dowloadimg/files/11_12_2017_1.png) Но вот на других девайсах приложение файл не сохраняет(ПрогрессДиалог открывается и сразу закрывается). В чем может быть проблема? Делаю через AsyncTask.

'''

private File downloadAndSaveImage(String mUrl) {

        try {
            URL url = new URL(mUrl);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.connect();
            BufferedInputStream input = new BufferedInputStream(url.openStream());
            int total = connection.getContentLength();
            int downloadedSize = 0;

            FileOutputStream fos = openFileOutput(getFileName(), Context.MODE_PRIVATE);
            byte[] buffer = new byte[8192];
            int bufferLength;
            while ((bufferLength = input.read(buffer)) != -1) {
                fos.write(buffer, 0, bufferLength);
                downloadedSize += bufferLength;
                //Log.d("downloaded ", String.valueOf(downloadedSize));
                publishProgress(downloadedSize, total);
            }
            connection.disconnect();
            input.close();
            fos.flush();
            fos.close();

            return null;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }

    }

'''


Ответы (0 шт):