언어 설정

Menu
Sites
Language
How to create new file on external USB Mass Storage device on a Samsung TV with Tizen 5.0 with Xamarin.Forms?

Hello!

I'm trying to create a new file with Xamarin.Forms on an external USB mass storage but I get an exception.

System.UnauthorizedAccessException: Access to the path '/opt/media/USBDriveA1/hello.txt' is denied. ---> System.IO.IOException: Permission denied

I believe I sign the app with a public certificate but I'm not sure I did the config right. I also added the following privileges to the tizen-manifest.xml:
http:// tizen.org/privilege/externalstorage
http:// tizen.org/privilege/mediastorage

I have the Tizen.NET nuget package in the multiplatform Xamarin.Forms project and the Tizen.NET.TV in the Tizen.TV project.

I tried with calling File.WriteAllText("/opt/media/USBDriveA1/hello.txt", "world") from the multiplatform project but it gave me the above exception.

I saw that the Web API has functionality to read and write files, is this possible from Tizen.NET?

Thanks in advance!

 

 

Responses

5 댓글
Tizen .NET

Hi,
If you declared the privileges you mentioned, I think your app should work without any errors.
File creation and read/write in external storage worked well with simple test app.
Could you check it once with it?
If you can see the log (via sdb shell, Tizen Device Manager, or Tizen Log Viewer), please check if "http://tizen.org/privilege/externalstorage" deny  occurs or not with DOTNET_LAUNCHER & CYNARA log tag.
Thanks.

Adam A-T

Hi,

thank you for your answer.

I downloaded the test app you provided but when I try to start debugging it in Visual Studio, it freezes, and it never gets installed on the TV itself.

I couldn't check the logs, it seems like the TV disables logging. e.g. sdb capability prints log_enable:disabled.

I found out after more testing that when I have an external HDD at UsbDrive1 and a flash drive at UsbDrive2, the app can access the Flash Drive but gets the UnauthorizedAccessException for the External HDD.

The TV itself can use the HDD without problem.

I'm awaiting your insight,
Thank you.

Tizen .NET

Hi,
Please check if externalstorage privilege is declared in tizen-manifest.xml file.
    <privileges>
        <privilege>http://tizen.org/privilege/mediastorage</privilege>
        <privilege>http://tizen.org/privilege/externalstorage</privilege>
    </privileges>

 

Adam A-T

Hi,

this is my whole tizen-manifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.tizen.example.MyMassStorageApp.Tizen.TV" version="1.0.0" api-version="5" xmlns="http://tizen.org/ns/packages">
    <profile name="tv" />
    <ui-application appid="org.tizen.example.MyMassStorageApp.Tizen.TV" exec="MyMassStorageApp.Tizen.TV.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
        <label>MyMassStorageApp.Tizen.TV</label>
        <icon>MyMassStorageApp.Tizen.TV.png</icon>
        <splash-screens />
    </ui-application>
    <shortcut-list />
    <privileges>
        <privilege>http://tizen.org/privilege/externalstorage</privilege>
        <privilege>http://tizen.org/privilege/mediastorage</privilege>
        <privilege>http://tizen.org/privilege/internet</privilege>
    </privileges>
    <dependencies />
    <provides-appdefined-privileges />
    <feature name="http://tizen.org/feature/screen.size.normal.1080.1920">true</feature>
</manifest>

 

 
Tizen .NET

Sorry for the inconvenience.
It seems to be a TV product issue.
I recommend you to get help from Samsung TV product team.
Thanks.

https://developer.samsung.com/support