Click here to Skip to main content
16,022,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi all,

I’m working on a Unity project where I’m trying to implement Google Play In-App Updates, specifically the immediate update flow. However, I’m encountering the following error:

CS1503: Argument 1: cannot convert from 'Google.Play.AppUpdate.AppUpdateType' to 'Google.Play.AppUpdate.AppUpdateOptions'


Context:
1.Objective: I’m trying to initiate an immediate update using the Google Play Core SDK in Unity.
2.Error Occurrence: The error arises when calling `StartUpdate()` with this code:
C#
var appUpdateRequest = appUpdateManager.StartUpdate(appUpdateInfo, appUpdateOptions);

3. My Setup:
- Unity Version:[2022.3.41f1]
- Google Play Core SDK Version: [2.1.0]
- Focusing only on immediate updates (not using flexible updates or prioritizing).

Code Snippet:
C#
IEnumerator CheckForUpdate()
{
    PlayAsyncOperation<AppUpdateInfo, AppUpdateErrorCode> appUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
    yield return appUpdateInfoOperation;

    if (appUpdateInfoOperation.IsSuccessful)
    {
        var appUpdateInfo = appUpdateInfoOperation.GetResult();
        var appUpdateOptions = AppUpdateOptions.ImmediateAppUpdateOptions(); // Immediate update flow setup
        var appUpdateRequest = appUpdateManager.StartUpdate(appUpdateInfo, appUpdateOptions);
        yield return appUpdateRequest;
    }
    else
    {
        Debug.LogError("Error fetching update info: " + appUpdateInfoOperation.Error);
    }
}


Questions:
1. How can I resolve the AppUpdateOptions type conversion error when starting the in-app update?
2. Is there a specific method to handle immediate updates in the Google Play Core SDK for Unity that I might be missing?

Any help or guidance would be much appreciated!

What I have tried:

I’ve already checked the documentation, and it seems like I'm using the correct method for immediate updates. But I’m still not sure how to fix this error.

- Is there something I’m missing in how I handle AppUpdateOptions or AppUpdateType?
- Do I need to set up something differently for immediate updates using the Play Core AP in Unity?

I would really appreciate it if anyone could point me in the right direction. Thanks!
Posted
Updated 3-Oct-24 3:56am
v3
Comments
Dave Kreskowiak 3-Oct-24 9:17am    
If you want to talk to people, **stop** **bracketing** **everything** **in** **asterisks**! (See how annoying that is?) You're just making everything harder to read.
abhishek_2 3-Oct-24 9:59am    
Sorry for the in inconvenience ,Actually it was supposed to make text bold , highlight , make heading using that.Removed it , Let me know if you could help me fix this.
thank you

Dave Kreskowiak 4-Oct-24 16:10pm    
Oh, I never said anything about Unity or Google Play Api. I have no reason to mess around with either.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900