So I have managed to get it to show an Image, However I'm still facing a problem.
If I copy and paste the link from my realtime database into the following code I manage to show the image on the page:
petimage.Source = ImageSource.FromUri(new Uri("https://firebasestorage.googleapis.com/v0/b/myapp.appspot.com/o/PetProfileImages%2Fimages.jpeg?alt=media&token=236dbe01-82d3-42b3-8f8b-f0bc9da99776")); //(This works)
If i call that same link from the real-time database into the same code like above seen below. I get an error message saying it can't be set to null.
petimage.Source = ImageSource.FromUri(pet.DownloadUrl));
If I then try and call that link from firebase storage and pass that string I get the following error:
Firebase.Storage.FirebaseStorageException: 'Exception occured while processing the request.
Url: https://firebasestorage.googleapis.com/v0/b/myapp.appspot.com/o/PetProfileImages%2F
Response: {
"error": {
"code": 400,
"message": "The path may not end with '/' or contain two consecutive '/'s"
}
}'
Here is how I am retrieving that link:
public async Task<string> GetFile(string fileName)
{
return await firebaseStorage
.Child("PetProfileImages")
.Child(fileName)
.GetDownloadUrlAsync();
}
private async void RetrivePetInfo()
{
var pet = await firebaseHelper.GetPet(PetName);
if (pet != null)
{
var _path = await GetFile(pet.ImageFileName);
if (_path != null)
{
petimage.Source = ImageSource.FromUri(new Uri(_path));
}
}
}