2

我正在尝试通过我的应用程序显示更新,但出现以下错误

com.google.android.play.core.install.InstallException:安装错误:-3

这是检查和更新应用程序的代码

public void checkAppUpdate(){
                    // Creates instance of the manager.

    // Returns an intent object that you use to check for an update.
                    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

    // Checks whether the platform allows the specified type of update,
    // and checks the update priority.
                    appUpdateInfoTask.addOnSuccessListener(new OnSuccessListener<AppUpdateInfo>() {
                        @Override
                        public void onSuccess(AppUpdateInfo appUpdateInfo) {
                            Log.i("UpdateError123",appUpdateInfo.updateAvailability()+"");

                            if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
                                // Request an immediate update.

                                try {
                        appUpdateManager.startUpdateFlowForResult(
                                // Pass the intent that is returned by 'getAppUpdateInfo()'.
                                appUpdateInfo,
                                // Or 'AppUpdateType.FLEXIBLE' for flexible updates.
                                AppUpdateType.IMMEDIATE,
                                // The current activity making the update request.
                                MainActivity.this,
                                // Include a request code to later monitor this update request.
                                1021);
                    } catch (IntentSender.SendIntentException e) {
                        e.printStackTrace();
                    }
                            }
                        }
                    });

                    appUpdateInfoTask.addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(Exception e) {
                       e.printStackTrace();
                       Log.i("UpdateError",e.toString()+"");
                        }
                    });
                }
4

0 回答 0