Xamarin Forms - Cannot get In-app Updates from App Center to work

Ganesh Gebhard 366 Reputation points
2021-05-14T15:25:38.59+00:00

Hey!

I have an app in Xamarin Forms (Android & iOS), which is distributed in App Center. I'm trying to enable the option to perform an in-app update when a new build has been completed, but I cannot get this to work. I'm using the tutorial on Microsoft Learn: https://learn.microsoft.com/en-us/appcenter/sdk/distribute/xamarin#remove-in-app-updates-for-google-play-builds

What I tried to build is the option to manually check for updates by pressing on a button. This button is just doing..nothing when I press it, but maybe someone here had that problem before as well.

The code that I have are given below. This example is for Android first (since I'm testing on a phyical Android device), but it should work for iOS as well.

Packages
So first I have installed the App Center Distribution package. Not the latest version (4.2.0), since the build is App Center fails then because it cannot handle version 4.1.0+ (I spoke to someone from App Center to confirm this).
96745-image.png

App.cs
Then in App.cs, I have the following code:

96685-image.png

Where OnReleaseAvailable is the following (literally from the docs):

96679-image.png

MainActivity (Android)
Then in the Android MainActivity, I added the option to enable this for debug builds:

96727-image.png

Check for Update option
Then I have a button on a ContentPage to check for updates:

96770-image.png

I believe I have everything then for this option, but when I press the button nothing happens, update found or no update found.

Does someone know what I'm missing here?

Best,
Ganesh

Developer technologies .NET Xamarin
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.