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

thank you very much for coming up with a design document... this is greatly appreciated...
and as I can see, we will be able to read and write also from/to the shared directories in future... :partying_face:

  • Shared - Reads and writes files to shared directories, such as Documents, Music, etc. The paths are rewritten to use the MediaManager API.

you mentioned in that document

The File component is the component most affected by Google's technical changes in Android and policy changes in Google Play.

what about the other components? Example: Let's assume, I like to take a picture and store that picture in the shared directories, so it will be available also for the Gallery app.

Will the new Scope functionality also be implemented in other components like the media components, especially Camera, Camcorder, ImagePicker, Player, Sound, SoundRecorder, VideoPlayer?

Taifun

3 Likes

At the moment the plan is to implement a property on the Form to control the default for all of the other components. A future release may bring the scope property to the other components if needed. The File component also adds a MakeFullPath method that given a scope and a path will return a fully qualified path that can be used with the other components if needed.

6 Likes

Good job for me. I think that this functionality is enough for now. If something is missing, it will definitely come out in the wash ...

I would like to test the new File component.
Is there an (approximate) date from when and where (on which test server) it can be tested?

I encountered some issues during testing that I'm working to fix. Hopefully it shouldn't be too much longer.

2 Likes

@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.