package com.gk.sharefile;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Intent;
import android.net.Uri;

    /**
     * http://developer.android.com/training/sharing/send.html
     */
    public class ShareFile extends CordovaPlugin {

        @Override
        public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
            if (action.equals("sharefile")) {
                String FileURI = args.getString(0);
                String title = args.getString(1);
                String mimetype = args.getString(2);
                this.sharefile(FileURI, title, mimetype, callbackContext);
                return true;
            }
            return false;
        }

        private void sharefile(String uriToFile, String title, String mimetype, CallbackContext callbackContext) {
          try {
            Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(uriToFile));
            shareIntent.setType(mimetype);
            cordova.getActivity().startActivity(Intent.createChooser(shareIntent, title));
            callbackContext.success();
            } catch(Error e) {
                callbackContext.error(e.getMessage());
            }
            
        }
    }

@@ -246,16 +246,37 @@
 net.Uri;
+%0Aimport java.io.File;
 %0A%0A    /*
@@ -609,16 +609,20 @@
 ing File
+Path
 URI = ar
@@ -776,16 +776,20 @@
 ile(File
+Path
 URI, tit
@@ -938,25 +938,24 @@
 (String 
-uriTo
 File
+Path
 , String
@@ -1132,16 +1132,60 @@
 _SEND);%0A
+            File file = new File(FilePath);%0A
         
@@ -1238,20 +1238,18 @@
 Uri.
-parse(uriToF
+fromFile(f
 ile)

Update ShareFile.java