File component - save (all types of) files in the Private dir (→ internal storage)

@Anke Here's a link to a test server. I'm still doing some bug fixes but it should give you an idea of how the updated component works. Please let me know of any issues you encounter.

5 Likes

I did a few tests on the test server with the File component, which don't seem to make much sense (or are not very helpful). Unfortunately I was only able to test with Companion (Android 11) because the build server does not work.

4 Likes

I've had a look at the design document for File API Changes which looks very useful indeed. One thing that bugs me is the fact that the Sharing component uses different file/path naming conventions from the File component (saving and reading). Will this be fixed in the update?

(I use the sharing component to share txt and csv files produced by apps with google drive and so my computer where I have a lot more flexibility.)

I'll have the build server set up today. I was trying to get this up before my vacation but didn't have enough time to finish the build functionality since there's some additional complexity there.

1 Like

same issue here :cry:connectionRefused

The build server is available now. Note that "I'll" expands to "I will" not "I have". :slight_smile:

3 Likes

Yes, sometimes you jump to conclusions. :wink:

2 Likes

I did a few tests with the APK:

  • The assets are not found.
    grafik
    grafik

  • What is the difference between
    grafik
    and
    grafik
    And why is there no method to check the existence of a → file?

  • As soon as an extension is used, "... unable to compile ..."

  • The app crashes immediately with this block:

  • With this block:


    I get: → []
    and with this:

    I get: → ["abc.txt"].
    But there are two files in the assets (→ abc.txt and also: → foto.jpg).

1 Like

Addendum:
I tested on Android 11 (Pixel 2XL). On Android 9 (Galaxy Note8) I get (under the last point) in both cases: → [].

1 Like

When using the // slashes in a filename you have to set the filescope to legacy i think.

  • Legacy - Interprets the file name based on the older File semantics. A filename starting with two slashes (i.e., "//") will be read from the assets. A filename starting with a single slash (i.e., "/") will be read from the root of the external storage directory on SDK versions prior to SDK 29. From SDK 29+, it will be read/written in the app-private directory on the external storage. A file without a starting slash will be read/written in the app's private directory (equivalent to Private scope).

I had already tried this (unsuccessfully). But since the File.ReadFrom_fileName method does not provide any other option (to read from assets), this should be preset.

The permissions from the last companion on Google Play are:

This app has access to:

Contacts

  • read your contacts
  • find accounts on the device

Identity

  • add or remove accounts
  • find accounts on the device

Camera

  • take pictures and videos

Microphone

  • record audio

Storage

  • read the contents of your USB storage
  • modify or delete the contents of your USB storage

Wi-Fi connection information

  • view Wi-Fi connections

Phone

  • read phone status and identity

Photos/Media/Files

  • read the contents of your USB storage
  • modify or delete the contents of your USB storage

Location

  • approximate location (network-based)
  • access extra location provider commands
  • precise location (GPS and network-based)

Device ID & call information

  • read phone status and identity

Device & app history

  • read sensitive log data

Other

  • view configured accounts
  • control Near Field Communication
  • pair with Bluetooth devices
  • mock location sources for testing
  • view network connections
  • control vibration
  • access Bluetooth settings
  • full network access
  • act as the AccountManagerService
  • use accounts on the device

The permissions from this companion from the testserver are:

Camera
Contacts
Location
Microphone
Phone

So i guess in order to use it you have to set permissions yourself. I was not able to upload any asset to the phone using the companion.

This is from the androidmanifest.xml from the test companion

<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:maxSdkVersion="18" android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.ACCOUNT_MANAGER"/>
<uses-permission android:name="com.google.android.apps.googlevoice.permission.RECEIVE_SMS"/>
<uses-permission android:name="com.google.android.apps.googlevoice.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:maxSdkVersion="18" android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.READ_LOGS"/>

But in my phone i could only see:
Camera
Contacts
Location
Microphone
Phone

Is this a general statement or does it relate to my problem? Of course, no permissions should be required to read from the assets.

I don't know if it relates to your problem, it was just something i noticed and thought that maybe it could be related :wink:

If i try to upload an asset using the companion i get the following error.

That's obvious. :slightly_smiling_face:
You need to either reload page or reconnect to companion.

No, this happens with a new connection after a reset connection. So totally fresh. :grin:

Android version?