In-App Update using Play Core Library

Hey you guys, need help!!

I have an app in Google Play that scan some QR Codes, and these Codes had a pattern, and we have to change it, because the read is very very slow. We will update the QRs and the App, but we have to force an update and keep the correct functionality. I was reading about an "in-app update" on https://developer.android.com/guide/app-bundle/in-app-updates and in there, they say that requires a library called Play Core. There is a Play Core Library for Xamarin? Considering that this site uses Android Studio (Java) for implementations references.

Answers

  • artfcartfc Member

    test

  • noteshipnoteship Member

    test

  • PatriceVBPatriceVB Member

    I'm also interested in any information about how to achieve in app update thanks this new Google Play capability.

    I do not found any information about how to use Play Core in Xamarin.

    Any ideas?

  • FreakyAliFreakyAli USMember ✭✭

    I guess this is unavailable for now, I am planning to make a Xamarin Binding for Play Core will get back to you guys as soon as it's done

  • Brand00wnBrand00wn Member ✭✭

    I'll be anxiously waiting

  • FreakyAliFreakyAli USMember ✭✭

    Hey, guys, I was able to complete the binding creation and I will be updating it on Nuget soon, for now, you guys can pick it up from my drive: https://drive.google.com/file/d/1r8QuqW25PKcQty0W_Q0eEgMcA8ynt_3J/view?usp=sharing

  • Brand00wnBrand00wn Member ✭✭

    Awesome!! I'll test and give you a feedback soon.

  • FreakyAliFreakyAli USMember ✭✭

    Sure let me know, I sort of gave it one round of test and it seems to be working great...

  • funklet1funklet1 Member ✭✭

    @G.Hakim
    The binding is very useful and works for the immediate update perfectly.
    I am having some difficulty getting the InstalledStateUpdateListener to work. The compiler has some issues with ThisInstalledStateListener.java
    error: ThisInstallStateUpdatedListener is not abstract and does not override abstract method onStateUpdate(InstallState) in StateUpdatedListener public class ThisInstallStateUpdatedListener
    error: name clash: onStateUpdate(Object) in ThisInstallStateUpdatedListener and onStateUpdate(StateT) in StateUpdatedListener have the same erasure, yet neither overrides the other public void onStateUpdate (java.lang.Object p0) where StateT is a type-variable: StateT extends Object declared in interface StateUpdatedListener

        class ThisInstallStateUpdatedListener : Java.Lang.Object, IInstallStateUpdatedListener
    {
        void IStateUpdatedListener.OnStateUpdate(Java.Lang.Object p0)
        {
            // Handles a Flexible AppUpdate
                if ((p0 as InstallState).InstallStatus() == InstallStatus.Downloaded)
                    ShowMessage("An update has just been downloaded and will install now.", "OK", (s, e) => appUpdateManager.CompleteUpdate(), string.Empty, null, false);
        }
    }
    

    Could you help and also is there any news on the Nuget?
    Thanks!

  • FreakyAliFreakyAli USMember ✭✭

    @funklet1 Hi happy to know it helps you out, secondly I would like to know how exactly are you using the ThisInstallStateUpdatedListener and what are you using it for. Also, note that I am a tad bit busy but I will be uploading it to Nuget really soon. Sorry for the delay everyone!

  • funklet1funklet1 Member ✭✭

    @FreakyAli,

    I appreciate that you are busy and the NuGet would be the icing on the cake but I like cake even if it doesn't have icing on it..

    I want to implement the Listener for the install state so that when the Flexible update is ready I can inform the user so they can update.

    From the developer.android.com section guide/app-bundle/in-app-updates#monitor_flexible

    // Create a listener to track request state updates.
    InstallStateUpdatedListener listener = state -> {
        // Show module progress, log state, or install the update.
      };
    
    // Before starting an update, register a listener for updates.
    appUpdateManager.registerListener(listener);
    
    // Start an update.
    
    // When status updates are no longer needed, unregister the listener.
    appUpdateManager.unregisterListener(listener);
    

    All help is greatly appreciated.

  • FreakyAliFreakyAli USMember ✭✭

    Well from the above code I understand that you are trying to get the flexi-update interface set up now I haven't used it yet, But this is how it should look from my understanding

            // Create a listener to track request state updates.
            IInstallStateUpdatedListener listener = new MyInstallStateUpdatedListener();
    
            // Before starting an update, register a listener for updates.
            mAppUpdateManager.RegisterListener(listener);
    
            // Start an update.
    
            // When status updates are no longer needed, unregister the listener.
            mAppUpdateManager.UnregisterListener(listener);
    

    And this is how the class would look

           public class MyInstallStateUpdatedListener : Java.Lang.Object, IInstallStateUpdatedListener
           {
                     void IStateUpdatedListener.OnStateUpdate(Java.Lang.Object p0)
                    {
                         // Handles a Flexible AppUpdate
                        if ((p0 as InstallState).InstallStatus() == InstallStatus.Downloaded)
                        { }
                    }
            }
    

    I hope this is what you were looking for, if not please feel free to get back at anytime

  • funklet1funklet1 Member ✭✭

    Yes, if you look at my code above you can see that my class is functionally identical to the one that you have provided.

    Unfortunately in VS2017 there is a compiler error.

    The compiler has some issues with ThisInstalledStateListener.java
    error: ThisInstallStateUpdatedListener is not abstract and does not override abstract method onStateUpdate(InstallState) in StateUpdatedListener public class ThisInstallStateUpdatedListener
    error: name clash: onStateUpdate(Object) in ThisInstallStateUpdatedListener and onStateUpdate(StateT) in StateUpdatedListener have the same erasure, yet neither overrides the other public void onStateUpdate (java.lang.Object p0) where StateT is a type-variable: StateT extends Object declared in interface StateUpdatedListener

    I don't know if the compiler error is due to an issue in the dll or Visual Studio so I am unable to troubleshoot further.

    Perhaps if you could provide the source to the binder project..

  • funklet1funklet1 Member ✭✭

    Please see the following, I believe that this is the issue I am facing, hopefully you can make modifications to your binding project to help out..

    www.andipalo.com/2017/07/16/java-seesharp-xamarin/

  • FreakyAliFreakyAli USMember ✭✭

    I will look into it ASAP, will let you know if I get somewhere also I plan on adding the binding to Github today will link it here, Also you will be free to contribute to it :#

  • AldyPutraAldyPutra USMember ✭✭

    guys is any update ? i need play core for xamarin android to use in app update feature, thanks for advance :)

  • Julien_PerezJulien_Perez Member ✭✭

    @FreakyAli Any updates about the nuget package ?

Sign In or Register to comment.