46
Views
1
Comments
[App Version Plugin] Plugin not loaded incombination with other plugin
app-version-plugin
Mobile icon
Forge asset by David Pereira Cruz
Application Type
Mobile

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:

  1. https://www.outsystems.com/forge/component-overview/3078/appavailability-plugin
  2. https://www.outsystems.com/forge/component-overview/6328/zebra-datawedge-connector-plugin

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

testapp_v2.oml
2024-05-21 13-27-28
David Pereira Cruz

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;
    }


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.