Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/farynam/cordova-fileassociation

File association plugin for cordova. Main purpose is to make possible to assciate cordova app with file types well known or custom made.
https://github.com/farynam/cordova-fileassociation

Last synced: 6 days ago
JSON representation

File association plugin for cordova. Main purpose is to make possible to assciate cordova app with file types well known or custom made.

Awesome Lists containing this project

README

        

# cordova-fileAssociation
File association plugin for cordova. Main purpose is to make possible to associate cordova app with file types well known or custom made. Currently it is for Android only.

How to use it
1.Clone from git git clone
2.Configure your AndroidManifest.xml activity for example for json file:

....

......



















.....




3.Add plugin to project by:
cordova plugin add /FileAssociation

4.Register listeners in your cordova app to be sure that plugin is available to use:

var fileAssociation = function () {
if (!window.plugins) {
console.log("plugins not defined");
return;
}

window.plugins.fileAssociation.getAssociatedData(null,
function (success) {
try {
if (success != null) {
//handle your data here maybe ex. by promise
activityPromise.resolve(decoded);
}
} catch (e) {
activityPromise.reject(e);
}
}, function (error) {
activityPromise.reject(error);
});
};

//added to be sure that plgin is available

document.addEventListener("resume", function () {
fileAssociation();
}, false);

document.addEventListener("deviceready", function () {
fileAssociation();
}, false);

5.Use well