Hi,
I installed the App Version Plugin in most of our apps and this component works like a charm. However in one of our app the plugin doesnt seem to load. i tried somethings and it seems to be related to other plugins we need to use within this app. The other plugins are:
Does anyone have a suggestion how to fix this? I have included a module to show an example. Please note that the App Version Plugin only works on a device or a emmulator (not Outsystsems Now). We are running on android devices. havent check the behavior on IOS.
Cheers
Hi Jørgen,
I've looked at the plugins cordova codes (at least for Android), and I suspect that this one and the AppAvailability are doing the same override in the execute of the CordovaPlugin.
App Version Plugin - https://github.com/Rareloop/cordova-plugin-app-version/blob/master/src/android/RareloopAppVersion.java
AppAvailability - https://github.com/kelter-antunes/AppAvailability/blob/OS11_1.0.2/src/android/AppAvailability.java
I think to be able to use both you will need to create a new one that will merge both codes on the execute. I would see something like
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("getAppVersion")) { try { PackageManager packageManager = this.cordova.getActivity().getPackageManager(); JSONObject r = new JSONObject(); r.put("version", packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionName); r.put("build", packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionCode); callbackContext.success(r); } catch (NameNotFoundException e) { callbackContext.error("Exception thrown"); } return true; } else if(action.equals("checkAvailability")) { String uri = args.getString(0); this.checkAvailability(uri, callbackContext); return true; } // Default response to say the action hasn't been handled return false; }