Start a new topic

C++ Plugin Register wrongly put in your documentation

Hey there,

I am currently trying to Register a C++ Plugin in my application. In your documentation of Wikitude SDK for Android (Javascript 8.9.0) about the Plugins API you specify on how to register a plugin in onPostCreate() like this:


@Override protected void onPostCreate(final Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); this.architectView.registerNativePlugins("pluginLibraryName"); }


or


@Override protected void onPostCreate(final Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); this.architectView.registerNativePlugins("pluginLibraryName", "plugin_1"); }


These methods are not available by the architectView. They are deprecated.

So, in your Input Plugins API, you specify on how to Register a Plugin in the onPostCreate() like this:



    this.architectView.registerNativePlugins("wikitudePlugins", "simple_input_plugin", new PluginManager.PluginErrorCallback() {

        @Override

        public void onRegisterError(int errorCode, String errorMessage) {

            Log.v(TAG, "Plugin failed to load. Reason: " + errorMessage);

        }

    }); // sets this activity in the plugin

    initNative();


    setFrameSize(FRAME_WIDTH, FRAME_HEIGHT);

}


PluginErrorCallback seems to be deprecated as well. So I used simple ErrorCallback and declared a PluginManager, like this:


import com.wikitude.common.ErrorCallback;

import com.wikitude.common.WikitudeError;

import com.wikitude.common.plugins.PluginManager;


private PluginManager plmanager;


plmanager.registerNativePlugins("wikitudePlugins", "markertracking", new ErrorCallback() {

            @Override

            public void onError(@NonNull WikitudeError error) {

                Toast.makeText(ARActivity.this, "Could not load plugin. Reason: " + error.getMessage(), Toast.LENGTH_LONG).show();

            }

 

        });


Is this the right way to register a C++ Plugin? If so, you should update your documentation because it's very confusing.

Thank you very much.




Hi Nikolas,



you are correct, we have changed this API and seem to have not updated our documentation fully, thanks for highlighting this. The API reference should be current, though, and the PluginManager.PluginErrorCallback type should be available. Instantiating your own PluginManager instance is not the way to go. You should be able to simply pass null for the callback as a first implementation.



- Daniel

If PluginManager.PluginErrorCallback happens to not be available, would you mind posting the error message you are getting, or even the entire code you are using?


- Daniel

Hello Daniel,

Thank you for your answer.

When using PluginManager.PluginErrorCallback I am getting a warning that the Callback is deprecated.

No errors, just this warning. It's method, the onRegisterError() doesn't get triggered at all.  So, 
 PluginManager.PluginErrorCallback doesn't do nothing I guess.

Nick


I apologize for my previous post, since it was wrong.

The onRegisterError() get's triggered correctly.

No worries. I'll have a closer look at what's going on with the deprecation warning and will change the documentation accordingly.


- Daniel

Hi Nikolaos,



it seems you were correct all along. The `registerNativePlugins(String libraryName, PluginErrorCallback pluginCallback)` and `registerNativePlugins(String libraryName, String pluginName, PluginErrorCallback pluginCallback)` functions of the plugin manager are deprecated, but still used by the `ArchitectView`. The `PluginManager` already provides replacements, `registerNativePlugins(String libraryName, ErrorCallback errorCallback)` and `registerNativePlugins(String libraryName, String pluginName, ErrorCallback errorCallback)`, but they are not used by the `ArchitectView` yet. That is at least my interpretation of the current state.


You still will need the method of the `ArchitectView` and not create your own `PluginManager` instance, though.


I'll inform our Android developers about this issue. Thanks again for bringing it up.



- Daniel



Login or Signup to post a comment