【问题标题】:In App Update not showing Update Screen untill I open playstore and see update button in Android在我打开 Playstore 并在 Android 中看到更新按钮之前,在应用更新中不显示更新屏幕
【发布时间】:2021-08-30 11:30:37
【问题描述】:

我在我的 android 应用程序中实现了应用程序内更新功能,但在我转到 Playstore 应用程序并查看更新按钮之前它无法正常工作。 请建议我一些解决方案。 谢谢

   public void ImmidateUpdate()
    {

        AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(getActivity());

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

// Checks that the platform will allow the specified type of update.
        appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
            if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE)
            {
                if(appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE))
                {
                    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.
                                getActivity(),
                                // Include a request code to later monitor this update request.
                                1210);
                    } catch (IntentSender.SendIntentException e) {
                        e.printStackTrace();
                    }
                }

            }
        });

    }

【问题讨论】:

    标签: android in-app-update


    【解决方案1】:

    使用 Google Play Developer API 设置优先级,如 Play Developer API 文档中所述。应在 Edit.tracks: update 方法中传递的 Edit.tracks 资源中指定应用内更新优先级。

    请参考documntation

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-04
    • 2021-05-27
    • 1970-01-01
    • 1970-01-01
    • 2021-10-11
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    相关资源
    最近更新 更多