Skip to content

Commit

Permalink
Android11以上安装未知来源变更
Browse files Browse the repository at this point in the history
  • Loading branch information
wandersnail committed Aug 15, 2024
1 parent 9a6114e commit 43e4b29
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'

def lib_version = '1.3.7'
def lib_version = '1.3.8'
def user_name = 'wandersnail'
def lib_group = 'cn.wandersnail'
def lib_artifact = 'commons-android'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public void onActivityResult(int requestCode) {
*/
public void install() {
Objects.requireNonNull(apkFile, "apkFile is null");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !activity.getPackageManager().canRequestPackageInstalls()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
Build.VERSION.SDK_INT < Build.VERSION_CODES.R &&
!activity.getPackageManager().canRequestPackageInstalls()) {
Uri uri = Uri.parse("package:" + activity.getPackageName());
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, uri);
activity.startActivityForResult(intent, REQUEST_CODE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ private void onActivityResult() {
public void install() {
Activity activity = getActivity();
if (activity != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
Build.VERSION.SDK_INT < Build.VERSION_CODES.R &&
!activity.getPackageManager().canRequestPackageInstalls()) {
Uri uri = Uri.parse("package:" + activity.getPackageName());
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, uri);
Expand Down

0 comments on commit 43e4b29

Please sign in to comment.