| | |
| | | { |
| | | Intent _intent = new Intent(Intent.ACTION_VIEW); |
| | | |
| | | if (Build.VERSION.SDK_INT >= 23) |
| | | { |
| | | _intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | Uri _contentUri = FileProvider.getUriForFile(activity, |
| | | "com.shandangceshi.snxxz.fileProvider", |
| | | _file); |
| | | _intent.setDataAndType(_contentUri, "application/vnd.android.package-archive"); |
| | | |
| | | } |
| | | else |
| | | { |
| | | // if (Build.VERSION.SDK_INT >= 23) |
| | | // { |
| | | // _intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | // Uri _contentUri = FileProvider.getUriForFile(activity, |
| | | // "com.shandangceshi.snxxz.fileProvider", |
| | | // _file); |
| | | // _intent.setDataAndType(_contentUri, "application/vnd.android.package-archive"); |
| | | // |
| | | // } |
| | | // else |
| | | // { |
| | | _intent.setDataAndType(Uri.fromFile(_file), |
| | | "application/vnd.android.package-archive"); |
| | | _intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | |
| | | } |
| | | // } |
| | | |
| | | activity.startActivity(_intent); |
| | | |