Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to access Files from Platform Specific Folders in Xamarin.Forms?

BIGPIZZA95BIGPIZZA95 Member ✭✭

Hey,
I want to access a File in Xamarin.Forms which is located in the Resources folder of my Xamarin.Android / Xamarin.iOS. Is this even possible?
The other way round isn't a possibility because the files on the platform specific parts get referenced via javascript (needed for augmented reality functions).

Tagged:

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited April 7

    I want to access a File in Xamarin.Forms which is located in the Resources folder of my Xamarin.Android / Xamarin.iOS. Is this even possible?

    We cannot access the platform files directly in Xamarin.Forms. Xamarin.Forms provides DependencyService which could help to invoke native platform functionality from shared code. Try to access the file on the platform project, then call the method in Xamarin.Forms using DependencyService.

    Related tutorial:
    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction

Sign In or Register to comment.