Android 13 READ Files in Smartwatch

525 Views Asked by At

I am developing an application for a Wear OS system that creates a txt file and saves it in a certain folder.

My problem is that I have changed my watch and now the one I'm using has Android 13 API 33 and the permissions I had to save and edit the generated files are not working.

I have found this on internet "Based on the Android documentation READ_EXTERNAL_STORAGE permission has no effect starting from API level 33. For API level 33 and above you can use READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, READ_MEDIA_AUDIO permissions depending on your use case"

None of them are something like READ_MEDIA_FILES o similar

Until now, i used

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

I have this error

`Process: com.XXXX, PID: 27273     java.lang.RuntimeException: Unable to start service com.XXXX.controller.SensorsService@eabe365 with Intent { cmp=com.XXXX/.controller.SensorsService (has extras) }: java.lang.RuntimeException: java.io.FileNotFoundException: /storage/emulated/0/20f91a8a85b2cd47_28-09-23_14-34-09.txt: open failed: EPERM (Operation not permitted)`

do you know what the new permissions are or what I have to do for it?

2

There are 2 best solutions below

0
1HaKr On BEST ANSWER

Storage permissions are broken in Wears OS 4. There is an official bug logged about this. https://issuetracker.google.com/issues/299174252

6
blackapps On

You do not need any permission on an Android 13 device to create files in all public directories on external storage.

And certainly also you do not need any READ permission to WRITE a file.

Once you created your file -without needing any permission- you are automatically allowed to read your file.