Android Oreo应用程序内升级(API版本26)

Android Oreo应用程序内升级(API版本26),android,android-8.0-oreo,Android,Android 8.0 Oreo,我的应用程序在Play Store之外发布,当有新版本可用时,它将在应用程序内升级。我正在使用下面的代码开始安装(使用DownloadManager下载文件后) 对于安卓N(24): 对于Android 23及以下版本: final Uri uri = Uri.parse("file://" + destination); Intent install = new Intent(Intent.ACTION_VIEW); install.setFlags(Intent.FLAG_ACTIVITY_

我的应用程序在Play Store之外发布,当有新版本可用时,它将在应用程序内升级。我正在使用下面的代码开始安装(使用
DownloadManager下载文件后

对于安卓N(24):

对于Android 23及以下版本:

final Uri uri = Uri.parse("file://" + destination);
Intent install = new Intent(Intent.ACTION_VIEW);
install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
install.setDataAndType(uri,"application/vnd.android.package-archive");
startActivity(install);

当我对“Android N”使用相同的代码时,它没有显示Android Oreo中的系统安装活动。有人解决了这个问题吗?

你要求了吗?还没有,让我试试。你要求了吗?还没有,让我试试。
Uri contentUri = FileProvider.getUriForFile(ctxt, BuildConfig.APPLICATION_ID + ".provider", new File(destination));
Intent openFileIntent = new Intent(Intent.ACTION_VIEW);                        
openFileIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);                    
openFileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
openFileIntent.setData(contentUri);
startActivity(openFileIntent);
final Uri uri = Uri.parse("file://" + destination);
Intent install = new Intent(Intent.ACTION_VIEW);
install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
install.setDataAndType(uri,"application/vnd.android.package-archive");
startActivity(install);