Your account admin has placed restrictions on sending files of certain types android While updating application from my server

Viewed 6118

I have an application in which I have in app updating. I download APK file from the server using FTP connection and use

File destination = new File(
                    Environment.getExternalStorageDirectory() ,"test-1.apk");

            Intent intent = new Intent(Intent.ACTION_VIEW);
            Uri uri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".provider",destination);

            intent.setDataAndType(uri, "application/vnd.android.package-archive");
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            startActivity(intent);

to install application.

Permissions added:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

Error

But on some devices I am getting this message. It works ok with most of the devices, so it might be the device specific issue. I would really appreciate any information regarding this.

1 Answers

Change the source from which you're installing the app and use a source you hadn't granted permission to before. For example, if you're getting this error after downloading the app from Firefox, download it using Chrome. Or if you're installing it from one File Manager app, install from another. Bottom line, install from another app.

That's the sort of "hack" I always use to overcome this issue. I send the same instructions to my clients and they all test their apps successfully

Related