package uk.co.whiteoctober.cordova;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager;

public class AppVersion extends CordovaPlugin {
	@Override
        public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {

		try {	
			if (action.equals("getVersionNumber")) {
				PackageManager packageManager = this.cordova.getActivity().getPackageManager();
				callbackContext.success(packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionName);
			return true;
			}
			return false;
		} catch (NameNotFoundException e) {
			callbackContext.success("N/A");
			return true;
		}
	}

}

@@ -141,16 +141,76 @@
 NArray;%0A
+import org.json.JSONException;%0Aimport org.json.JSONObject;%0A%0A
 import a

Update AppVersion.java