title: How to notify when an update is available without restarting the app in Xamarin C#
body: <p>I have created methods that compare a locally downloaded json file with the json of the url. If the downloaded file is different from the json of the url. When you restart the app, it only gives the message on the main page that an update is available.</p>
  <p>This looks like this in the main page</p>
  <pre><code>    protected override async void OnAppearing()
      {
          base.OnAppearing();
          {
              await Api.UpdateContentJson();
          }   
      }
  </code></pre>
  <p>This does the check if you are on the main page with a working internet connection when you restart the app.</p>
  <p>But I want it to say it directly anywhere in the app without having to restart the app with a working internet connection!</p>
  <p>This is my code to compare the JSON and download if different</p>
  <pre><code>public static async Task UpdateContentJson()
  {
      string FolderName = MainPage.GetJsonName();
      try
      {
          const string jsonName = &quot;getlatest.json&quot;;
          string updateCheckJsonPath = path + &quot;/&quot; + jsonName;
  
          string jsonFromUrl = await GetNewestMediaVersion();
          string currentVersion = CurrentVersionContentJson();
          if (!currentVersion.Equals(jsonFromUrl))
          {
              bool result = await Application.Current.MainPage.DisplayAlert(&quot;Update&quot;,
                  &quot;New changes in the courses are available! Do you want to update it?&quot;, &quot;Yes&quot;, &quot;No&quot;);
  
              //install newest update
              if (result)
              {
                  await DownloadJson();
              }
          }
          else
          {
              return;
          }
      }
      catch (Exception)
      {
      }
  }
  
  
  //for reading current versions json
  private static string CurrentVersionJson()
  {
      RootAppVersion rootObject = new RootAppVersion();
  
      string currentVersion;
      using (StreamReader r = new StreamReader(path + &quot;/&quot; + &quot;getappversion.json&quot;))
      {
          currentVersion = r.ReadToEnd();
          rootObject = JsonSerializer.Deserialize&lt;RootAppVersion&gt;(currentVersion);
      }
  
      return currentVersion;
  }
  
  //for getting the newest content version json from url
  private static async Task&lt;string&gt; GetNewestMediaVersion()
  {
      WebClient client = new WebClient();
      const string url = &quot;https://test.getappversion.cloud/getappversion&quot;;
      client.Headers.Add(&quot;Authorization&quot;, await Header.GetAuthorizationHeader());
      string jsonFromUrl = client.DownloadString(url);
      return jsonFromUrl;
  }
   
   
  </code></pre>
  <p>How can I get this to check for the update all the time, and not just when I launch the app on the main page?</p>