Итак, я пытаюсь реализовать в обновлении приложения в моей игре Unity.
для тестирования я просто реализую гибкое обновление и создать новый выпуск во внутреннем треке тестирования и загружать еще одну версию с более высокой версией. Manager.
Я написал код после прочтения Google Doc, но есть много вещей неясно, поэтому я использовал чат GPT, но все же что -то не так.using System.Collections;
using UnityEngine;
using Google.Play.AppUpdate;
using Google.Play.Common;
using UnityEngine.UI;
public class InAppUpdate : MonoBehaviour
{
private AppUpdateManager appUpdateManager;
// The result from checking for an update, contains information about available updates.
private AppUpdateInfo appUpdateInfoResult;
void Start()
{
// Initialize the AppUpdateManager.
appUpdateManager = new AppUpdateManager();
// Start checking for updates immediately.
StartCoroutine(CheckForUpdate());
}
IEnumerator CheckForUpdate()
{
// Creates a PlayAsyncOperation to check for update info.
PlayAsyncOperation appUpdateInfoOperation =
appUpdateManager.GetAppUpdateInfo();
// Wait until the operation is done.
yield return appUpdateInfoOperation;
// If the operation encounters an error, log it and return.
if (appUpdateInfoOperation.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error checking for update: " + appUpdateInfoOperation.Error);
yield break;
}
// Get the AppUpdateInfo result.
appUpdateInfoResult = appUpdateInfoOperation.GetResult();
// Check if an update is available and if a flexible update is allowed.
if (appUpdateInfoResult.UpdateAvailability == UpdateAvailability.UpdateAvailable)
{
if (appUpdateInfoResult.IsUpdateTypeAllowed(AppUpdateOptions.ImmediateAppUpdateOptions()))
{
StartCoroutine(StartFlexibleUpdate());
}
}
else
{
Debug.LogError("Update is not available");
}
}
IEnumerator StartFlexibleUpdate()
{
// Define app update options for a flexible update.
var appUpdateOptions = AppUpdateOptions.FlexibleAppUpdateOptions();
// Creates an AppUpdateRequest to monitor the update flow.
var startUpdateRequest = appUpdateManager.StartUpdate(appUpdateInfoResult, appUpdateOptions);
// Loop while the update is not yet done.
while (!startUpdateRequest.IsDone)
{
// For flexible flow, the user can continue to use the app while
// the update downloads in the background.
// No UI elements here, as requested.
yield return null;
}
// Once IsDone, check for errors from the StartUpdate operation.
if (startUpdateRequest.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error starting flexible update: " + startUpdateRequest.Error);
yield break;
}
// After the StartUpdate operation is done, re-fetch AppUpdateInfo to get the latest InstallStatus.
var updatedAppUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
yield return updatedAppUpdateInfoOperation;
if (updatedAppUpdateInfoOperation.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error re-fetching update info after download: " + updatedAppUpdateInfoOperation.Error);
yield break;
}
AppUpdateInfo updatedAppUpdateInfo = updatedAppUpdateInfoOperation.GetResult();
// Check if the download completed successfully using the updated InstallStatus.
if (updatedAppUpdateInfo.AppUpdateStatus == AppUpdateStatus.Downloaded)
{
// Downloaded successfully, proceed to complete the update.
StartCoroutine(CompleteFlexibleUpdate());
}
else
{
// Handle other download statuses if necessary (e.g., pending, failed).
// This might occur if the download didn't complete for some reason even after IsDone.
Debug.LogWarning("Flexible update install status after download: " + updatedAppUpdateInfo.AppUpdateStatus);
}
}
IEnumerator CompleteFlexibleUpdate()
{
// Request the app update to be installed.
var result = appUpdateManager.CompleteUpdate();
yield return result;
// This line should typically not be reached if the update is successful,
// as the app will restart. If it is reached, an error occurred.
if (result.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error completing flexible update: " + result.Error);
}
}
}
< /code>
Я следую всем, что загружается на треки, и код версии приращения.
Мое устройство уже в тестировании электронных писем.
Я загружал старую версию по ссылке на внутреннее тестирование, а затем я загружаю новую версию.
Я правильно понимаю, но кнопку обновления не начинаю обновлять, а не в порядке. Отслеживает BCUZ, я получаю ошибку в классе, но каким -то образом исправил ее, добавив в основной шаблон.
Так что в настоящее время я очень расстроен, загружая новые версии снова и снова. < /p>
Подробнее здесь: https://stackoverflow.com/questions/797 ... utton-in-u
В обновлении приложения ошибка бросания «Пользователь отменен», когда я нажимаю кнопку «Обновление» в приглашении обновл ⇐ C#
Место общения программистов C#
1756642587
Anonymous
Итак, я пытаюсь реализовать в обновлении приложения в моей игре Unity.
для тестирования я просто реализую гибкое обновление и создать новый выпуск во внутреннем треке тестирования и загружать еще одну версию с более высокой версией. Manager.
Я написал код после прочтения Google Doc, но есть много вещей неясно, поэтому я использовал чат GPT, но все же что -то не так.using System.Collections;
using UnityEngine;
using Google.Play.AppUpdate;
using Google.Play.Common;
using UnityEngine.UI;
public class InAppUpdate : MonoBehaviour
{
private AppUpdateManager appUpdateManager;
// The result from checking for an update, contains information about available updates.
private AppUpdateInfo appUpdateInfoResult;
void Start()
{
// Initialize the AppUpdateManager.
appUpdateManager = new AppUpdateManager();
// Start checking for updates immediately.
StartCoroutine(CheckForUpdate());
}
IEnumerator CheckForUpdate()
{
// Creates a PlayAsyncOperation to check for update info.
PlayAsyncOperation appUpdateInfoOperation =
appUpdateManager.GetAppUpdateInfo();
// Wait until the operation is done.
yield return appUpdateInfoOperation;
// If the operation encounters an error, log it and return.
if (appUpdateInfoOperation.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error checking for update: " + appUpdateInfoOperation.Error);
yield break;
}
// Get the AppUpdateInfo result.
appUpdateInfoResult = appUpdateInfoOperation.GetResult();
// Check if an update is available and if a flexible update is allowed.
if (appUpdateInfoResult.UpdateAvailability == UpdateAvailability.UpdateAvailable)
{
if (appUpdateInfoResult.IsUpdateTypeAllowed(AppUpdateOptions.ImmediateAppUpdateOptions()))
{
StartCoroutine(StartFlexibleUpdate());
}
}
else
{
Debug.LogError("Update is not available");
}
}
IEnumerator StartFlexibleUpdate()
{
// Define app update options for a flexible update.
var appUpdateOptions = AppUpdateOptions.FlexibleAppUpdateOptions();
// Creates an AppUpdateRequest to monitor the update flow.
var startUpdateRequest = appUpdateManager.StartUpdate(appUpdateInfoResult, appUpdateOptions);
// Loop while the update is not yet done.
while (!startUpdateRequest.IsDone)
{
// For flexible flow, the user can continue to use the app while
// the update downloads in the background.
// No UI elements here, as requested.
yield return null;
}
// Once IsDone, check for errors from the StartUpdate operation.
if (startUpdateRequest.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error starting flexible update: " + startUpdateRequest.Error);
yield break;
}
// After the StartUpdate operation is done, re-fetch AppUpdateInfo to get the latest InstallStatus.
var updatedAppUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
yield return updatedAppUpdateInfoOperation;
if (updatedAppUpdateInfoOperation.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error re-fetching update info after download: " + updatedAppUpdateInfoOperation.Error);
yield break;
}
AppUpdateInfo updatedAppUpdateInfo = updatedAppUpdateInfoOperation.GetResult();
// Check if the download completed successfully using the updated InstallStatus.
if (updatedAppUpdateInfo.AppUpdateStatus == AppUpdateStatus.Downloaded)
{
// Downloaded successfully, proceed to complete the update.
StartCoroutine(CompleteFlexibleUpdate());
}
else
{
// Handle other download statuses if necessary (e.g., pending, failed).
// This might occur if the download didn't complete for some reason even after IsDone.
Debug.LogWarning("Flexible update install status after download: " + updatedAppUpdateInfo.AppUpdateStatus);
}
}
IEnumerator CompleteFlexibleUpdate()
{
// Request the app update to be installed.
var result = appUpdateManager.CompleteUpdate();
yield return result;
// This line should typically not be reached if the update is successful,
// as the app will restart. If it is reached, an error occurred.
if (result.Error != AppUpdateErrorCode.NoError)
{
Debug.LogError("Error completing flexible update: " + result.Error);
}
}
}
< /code>
Я следую всем, что загружается на треки, и код версии приращения.
Мое устройство уже в тестировании электронных писем.
Я загружал старую версию по ссылке на внутреннее тестирование, а затем я загружаю новую версию.
Я правильно понимаю, но кнопку обновления не начинаю обновлять, а не в порядке. Отслеживает BCUZ, я получаю ошибку в классе, но каким -то образом исправил ее, добавив в основной шаблон.
Так что в настоящее время я очень расстроен, загружая новые версии снова и снова. < /p>
Подробнее здесь: [url]https://stackoverflow.com/questions/79751694/in-app-update-throwing-error-user-cancelled-when-i-click-on-update-button-in-u[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия