cordova-plugin-document-contract
Android document / media provider plugin for Cordova
Installation
Install through the Cordova plugin repository:
cordova plugin add cordova-plugin-document-contract
Install directly from github:
cordova plugin add https://github.com/danjarvis/cordova-plugin-document-contract.git
Methods
The plugin exposes two functions for working with a document/media provider.
; // error callback
Resolves a content URI and retrieves a contract object.
An object of key/value pairs will get passed to the success
callback (keys will becolumns
that returned a value).
If columns
is not specified, the query will return all available columns. This is not recommended as it is inefficient.
Documentation for columns of interest:
; // error callback
Resolves a content URI, retrieves corresponding file data and writes it to a file in the application's data directory (cordova.file.dataDirectory).
Usage
For the below examples, assume that
contentUri
is valid Content URI (e.g. coming from a Google Drive Send Intent).- The Cordova File Plugin plugin is installed.
Get a full contract:
windowpluginsDocumentContract;
Get a specific contract:
windowpluginsDocumentContract;
Get file name and create file:
windowpluginsDocumentContract;
License
© Dan Jarvis 2015, MIT