Languages

Menu
Sites
Language
Save file in Tizen with Xamarin.Forms

I can save files in Android with Xamarin.Forms so:
public void SaveText (string filename, string text) {
var documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
var filePath = Path.Combine (documentsPath, filename);
System.IO.File.WriteAllText (filePath, text);
}
How can I do it in Tizen with Xamarin.Forms?

Thanks.

Responses

3 Replies
hobum kwon

Hello,

In Tizen .NET, you can get a folder path to save a file (e.g. database file) at runtime by calling below:

string dataPath = Tizen.Applications.Application.Current.DirectoryInfo.Data;

var filename = "abc"

var filePath = Path.Combine(dataPath, filename);

Note that Tizen.Applications.Application.Current.DirectoryInfo.Data is not available in portable projects since it is a Tizen specific API.

Thus, in portable projects you need to use DependencyService.Get<...> to access the value of Tizen.Applications.Application.Current.DirectoryInfo.Data in

Tizen projects.

Ernest Borowski

It`s now in: 

string path = Tizen.Program.Current.DirectoryInfo.Data + "filename.txt";

 

Alvarez

Will data stored to:

Tizen.Applications.Application.Current.DirectoryInfo.Data

survive application updates?