The Document Foundation recently assigned one of the packages of the Android tender to Igalia; in particular, the one about cloud storage and email sharing. Our proposal comprised the following tasks:
- Integrate the “share” feature of the Android framework to be able to send documents by email, bluetooth or any other means provided by the system.
- Provide the means for the community to develop integration of cloud storage solutions.
- Implement ownCloud integration as an example of how to integrate other cloud solutions.
- Extensive documentation of the process to integrate more cloud solutions.
The work is completed and the patches available in the repository; most of them are already merged in master, while ownCloud support lives in a different branch for now.
The Android-provided share feature allows to send a document not only through email but through bluetooth or any available methods, depending on the software installed in your device.
We have made this feature available to users through a context menu in the document browser, which pops up after a long press on a document.
Support for cloud storage solutions
This task consisted of creating an interface to develop integration of any cloud storage solution. The first step was abstracting the code that made direct access to the file system, so it could be replaced by the different implementations of storage services, which from now on will be denominated document providers.
Afterwards, we created two document providers for local storage: one to access the internal storage of the device and another one to conveniently access the Documents directory inside the storage. These two simple providers served as a test for the UI to switch between both; we used the Android drawer widget, which pops-up with a swipe gesture from the left of the screen.
All the operations in the Android document browser were being performed in the same thread. Besides being suboptimal, the development framework actually forbids running network code in the main thread of the application. The next step for us was isolating the code that might need networking access when interacting with a cloud provider, and run it in separate threads.
ownCloud document provider
At that point, we had everything in place to write the code to access an ownCloud server. We did it with the help of an Android library provided by ownCloud developers.
There was still another task, though; any cloud service will likely need some configuration from the user for login credentials and so. We had to implement a preferences screen to enter these settings and do the proper wiring for the provider to be able to listen to any changes in them.
To help other developers writing new document providers, we have tried to document the new code in detail, specially those interfaces that must be implemented to create new document providers. Besides, we will publish a document explaining how to extend the cloud storage integration here soon.
That’s all for now; to try the ownCloud provider you will have to build the feature/owncloud-provider-for-android branch yourself, while you will find the share feature in the packages already available in the Play Store or F-Droid. Hope you enjoy it!