title: App Center Distribute – In-app updates for Xamarin Forms
body: <p>I am reading this documentation about app center in-app updates. I want to try it so that every time there is a release of my app I don't need to uninstall my app and install the new release everytime. There is a sample code in the documentation but I don't know where to put it or how it works the documentation is not clear. The code below is the sample code from the documentation. My problem is how can I implement in-app updates for my app?</p>
  
  <blockquote>
    <p><a href="https://docs.microsoft.com/en-us/appcenter/sdk/distribute/xamarin" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/appcenter/sdk/distribute/xamarin</a></p>
  </blockquote>
  
  <pre><code>bool OnReleaseAvailable(ReleaseDetails releaseDetails)
  {
      // Look at releaseDetails public properties to get version information, release notes text or release notes URL
      string versionName = releaseDetails.ShortVersion;
      string versionCodeOrBuildNumber = releaseDetails.Version;
      string releaseNotes = releaseDetails.ReleaseNotes;
      Uri releaseNotesUrl = releaseDetails.ReleaseNotesUrl;
  
      // custom dialog
      var title = "Version " + versionName + " available!";
      Task answer;
  
      // On mandatory update, user cannot postpone
      if (releaseDetails.MandatoryUpdate)
      {
          answer = Current.MainPage.DisplayAlert(title, releaseNotes, "Download and Install");
      }
      else
      {
          answer = Current.MainPage.DisplayAlert(title, releaseNotes, "Download and Install", "Maybe tomorrow...");
      }
      answer.ContinueWith((task) =&gt;
      {
          // If mandatory or if answer was positive
          if (releaseDetails.MandatoryUpdate || (task as Task&lt;bool&gt;).Result)
          {
              // Notify SDK that user selected update
              Distribute.NotifyUpdateAction(UpdateAction.Update);
          }
          else
          {
              // Notify SDK that user selected postpone (for 1 day)
              // Note that this method call is ignored by the SDK if the update is mandatory
              Distribute.NotifyUpdateAction(UpdateAction.Postpone);
          }
      });
  
      // Return true if you are using your own dialog, false otherwise
      return true;
  }
  </code></pre>