lorenzogiudici5
lorenzogiudici5

Reputation: 65

Unable to find the PCLstorage path in Android

I created a PCL project in Xamarin and I am trying to save files with a cross-platform solution using PCLstorage. This is my code (from the example in PCLstorage website)

IFolder rootFolder = FileSystem.Current.LocalStorage;
IFolder folder = await rootFolder.CreateFolderAsync("FolderName", CreationCollisionOption.OpenIfExists);
IFile file = await folder.CreateFileAsync("filename.txt", CreationCollisionOption.ReplaceExisting);
await file.WriteAllTextAsync("text");

Now, I want to know where this file is saved. In Windows Phone, using WP power tools, I can explore the isolatedStorage of my app and I find and open the txt file. While, in Android, I can't find the folder created! The path would be "data/data/com.appname.test/files/ but I don't find it!

Someone can help me?

Upvotes: 1

Views: 2563

Answers (2)

tech-gayan
tech-gayan

Reputation: 1413

if you want to store it in external storage you can pass the folder path and create the file. so you can access that file physically.

string path="path";
IFolder rootFolder = await FileSystem.Current.GetFolderFromPathAsync(path);
IFolder folder = await rootFolder.CreateFolderAsync("folder", CreationCollisionOption.OpenIfExists);
IFile file = await folder.CreateFileAsync("file", CreationCollisionOption.ReplaceExisting);

Upvotes: 0

choper
choper

Reputation: 1292

You will be able to access to that folder only from the device (not from PC using USB cable) and only with root rights, so you need to root your device (try SuperSu from GooglePlay it work for most of the devices)

Upvotes: 2

Related Questions