Onyx Beacon integration

  

Hi,

I tried to integrate the OnyxBeacon SDK into outsystems platfrom by creating a cordova plugin before encapsulating it to an outsystem module. However, the service studio is failed to generate the native platform:

The following errors have occurred:• Android: Error installing Cordova plugin: nativebuilder


The plugin works fine with this sample cordova app: https://github.com/kadekParwanta/OnyxReceiver

What might be the root cause of this issue?

Many thanks,

Hi Kadek,

What is the plugin identifier/url that you're trying to use on your application?

Also, please take a look on the next documentation to see if it can helps you:

Create a Plugin to Use Mobile Capabilities in Your Application


Cheers,

Luís Silva


Hi Luís,

I made the plugin myself, so I zipped the folder and use the resource. I also tried to use github URL instead of identifier since the plugin is not published, but it's still failed.


Here is the github URL:

https://github.com/kadekParwanta/com-cordova-ble


For your information, this plugin requires modification in the following files:

- build.gradle in project level

- own gradle configuration for its dependencies

- AndroidManifest.xml

These modifications are performed by hook and config.xml setup in the Cordova plugin.


Regards,

Kadek.

Hello Kadek,

The before_build hook is not supported yet.

Why do you need that hook?


Cheers,

Luís Silva


Hi Luís,


Thank you for your prompt response.

I need that hook to modify the main build.gradle (project level) to add the classpath dependencies for realm android as informed here: https://realm.io/docs/java/latest/#installation

I know that we can include a build-extras.gradle with the following method:

<framework src="some.gradle" custom="true" type="gradleReference" />

OutSystems must have supported that, but if I'm not mistaken, this gradle file is treated as an app level gradle. Normally, we define the dependencies (jar, aar, modules) of the app in this gradle file.


Do you have any other idea to achieve that beside using the before_build hook?


Regards,

Kadek


Hi Kadek,

Using the gradle file for your plugin like you said is enough. You don't need to manipulate the "original" one.

However, if you still need a hook you can use the before_plugin_install or after_plugin_install.

Cheers,

Luís Silva


Hi Luís,



Thank you for your suggestions.


Let's say I want to use the after_plugin_install hook. From the documentation, this hook is fired when we execute the following command in cordova project:

cordova plugin add [plugin_path]


Is this action also performed when we generate the native platform? Sorry for asking many questions, I'm still new to Outsystems. (I just want to make sure)


I've tried this, the sample app in cordova works fine:

But in OutSystems, it is still failed to generate the build as shown in the screenshot below:


The following errors have occurred:• Android: An unexpected error has occurred while generating your application. Please try again. If the problem persists, contact OutSystems Support.

With this error information, I find it hard to understand the root cause of this issue.


Using below method also doesn't work.

<framework src="some.gradle" custom="true" type="gradleReference" />


Is there any way to get the details log when the app is generated? Or do you have a working cordova plugin that utilize the before_plugin_install or after_plugin_install hook so that I can use it as reference, maybe my code is not completely compatible with OutSystems.


Note: I have an additional information.

If I use resource, the error will be "Error: Error installing Cordova plugin: nativebuilder"

While, if using the github URL, the error is the same as the screenshot above.

Does it mean that my plugin is totally not compatible with OutSystem?



Regards,

Kadek Juliana Parwanta.

Hi Kadek,

I have submitted a pull request to your repository with some changes that will add support for OutSystems apps. Also, it will be better if you avoid using private keys on a public repository.

With my changes you will need to use the plugin like this:

cordova plugin add https://github.com/kadekParwanta/com-cordova-ble --variable CLIENT_ID=<YourClientId> --variable SECRET=<YourSecret>

You can check the documentation here to help you creating your plugin with variables.

Cheers,
Luís Silva

Solution

Hi Kadek,

I have submitted a pull request to your repository with some changes that will add support for OutSystems apps. Also, it will be better if you avoid using private keys on a public repository.

With my changes you will need to use the plugin like this:

cordova plugin add https://github.com/kadekParwanta/com-cordova-ble --variable CLIENT_ID=<YourClientId> --variable SECRET=<YourSecret>

You can check the documentation here to help you creating your plugin with variables.

Cheers,
Luís Silva

Solution

Hi Luís,


It works like a charms. Thank you so much for the corrections.


Regards,

Kadek Juliana Parwanta