Using the File Browser Application
It is important to keep in mind that the file browsing application manipulates the two kinds of file repository-related things that are available in ThingWorx Composer once you import the entity file that is provided with the application:
A thing that was created using the FileRepository thing template.
A thing that was created using the RemoteThingWithFileTransfer thing template.
In general, file repositories allow you to upload and store files within them. Once a file is placed in a file repository, it can be moved to another file repository, using the File Transfer Subsystem of the ThingWorx platform. When you pass it a source and destination repository, the File Transfer Subsystem moves the file from the source to the destination for you.
The RemoteThingWithFileTransfer template allows you to create a remote thing that, when bound to an instance of the VirtualThing class on your edge device, allows you to create a remote file repository. This remote repository represents the files on your edge device as if they were in a file repository on your ThingWorx platform. As a result, you can use the File Transfer Subsystem on your platform to orchestrate moving files from that platform to your Android device. Your Android device asks the File Transfer Subsystem to copy a file from one repository to the other. The subsystem handles the transfer without any other work being done on your device.
To start experimenting with file transfers, create a sample file in the TestFileRepository that is created when you import the entity file that is provided with the File Browser sample application. To create a file, make the following service call on the TestFileRepository thing:
CreateTextFile path="mytestfile.txt",data="Hello world", overwrite=true
You should now have a file called mytestfile.txt that is visible in the file browsing application when it is running on your Android device. You can copy this file to the AndroidRemoteRepository using the application. To add repositories to the browser, add their names to the file, examples/android-file-browser/src/main/res/values/arrays.xml, under the key filesystems_arrays. You cannot copy any files to the root of the AndroidRemoteRepository because it is a virtual file system that contains each folder that your device registers with its FileTransferVirtualThing. The root of this file system is read only. In this example application, a directory called home has been registered, and you can copy files to it.
Was this helpful?