activity判断
This commit is contained in:
parent
8f3de4f376
commit
45f1c58266
@ -23,7 +23,6 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|||||||
private String downloadUrl;
|
private String downloadUrl;
|
||||||
private String title = "应用更新中";
|
private String title = "应用更新中";
|
||||||
|
|
||||||
|
|
||||||
public UpgradeModule(ReactApplicationContext reactContext) {
|
public UpgradeModule(ReactApplicationContext reactContext) {
|
||||||
super(reactContext);
|
super(reactContext);
|
||||||
this.reactContext = reactContext;
|
this.reactContext = reactContext;
|
||||||
@ -51,6 +50,7 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean _hasPermissionToInstall() {
|
private boolean _hasPermissionToInstall() {
|
||||||
|
Activity activity = reactContext.getCurrentActivity();
|
||||||
return activity != null && (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || activity.getPackageManager().canRequestPackageInstalls());
|
return activity != null && (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || activity.getPackageManager().canRequestPackageInstalls());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user