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" />
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.
