Search code examples
xamarin.formstaskvisual-studio-app-center

Xamarin Forms Appcenter how to get installation ID


I am trying to get the installation ID of the Appcenter to only send notifications to selected devices, but string installid = AppCenter.GetInstallIdAsync().ToString();

returns System.Threading.Tasks.Task1[System.Nullable1[System.Guid]]

And string installid = AppCenter.GetInstallIdAsync().Result.ToString(); returns empty string


Solution

  • The documentation states that you need to retrieve the installId as follows

    System.Guid? installId = await AppCenter.GetInstallIdAsync();
    

    You need to await the call, and then, you can cast the ToString.