Rhodes framework since v7.1 allows to build your Ruby/NodeJS Rhodes app as standalone lib and to use this lib within native Android, iOS or Windows Desktop/Tablet applications. It can be useful in the following cases:
Rhodes standalone lib provides a few ways to connect a native code and Rhodes local server Ruby code.
There we build Rhodes framework as standalone lib for the target platform and with all extensions in build.yml of your app. It must required each time when you change build.yml: change included extensions for example.
rake build:iphone:rhodeslib_framework[“<path to your native iOS app folder>”]
rake build:android:rhodeslib_lib[“<path to your native Android app folder>/app/libs/”]
rake build:win32:rhodeslib_lib[“<path to your native windows app folder >/RhodesApp”]
The dll with suffix “d” will be created if option build is set to ‘debug’ in build.yml. Necessary header files will be placed to rhoruby folder.
rake build:iphone:rhodeslib_bundle[“<full path to your native iOS application folder>”]
The command prepares Rhodes application bundle and puts it to root of XCode project folder. The folder RhoBundle should be placed in root of XCode project folder.
if you want to use the framework standalone lib and the you application bundle in your already existing XCode project make next steps after generate the framework lib and app bundle:
rake build:android:rhodeslib_bundle[“<full path to your native Android application folder>/app/src/main/assets/”]
The command prepares Rhodes application bundle and puts it to your Android project folder.
if you want to use the framework standalone lib and the you application bundle in your already existing Android project make next steps:
/app/libs/
in your Android app if it doesn’t exist;/app/src/main/assets/
(from shell or from Android Studio: right menu button on app item and -> new -> folder -> Assests Folder);implementation 'com.android.support:appcompat-v7:26.1.0' implementation(name:'<app name>', ext:'aar')
where <app name> is bundle name.
android:name="com.rhomobile.rhodes.RhodesApplication"
In sources:
com.rhomobile.RhodesActivity
onAppStart()
method. Example:class DefaultMain extends RhoMain { @Override public void onAppStart() { super.onAppStart(); } }
OnCreate
add code for setup Rhodes:RhodesService.setRhoMain(new DefaultMain());
onAppStart()
will be called when Rhodes application(server) already started.
rake build:win32:rhodeslib_bundle[“<full path to your native windows application folder>/RhodesApp”]
The command builds and compile of the bundle by set path. The Bundle will be placed to RhodesBundle folder.
Further connection of the library is no different from the connection of any other library. That is, the path to .lib (stub for .dll) and the path to headers are always indicated, depending on the IDE, this may look like differently, for an example with Visual Studio, look in rhodes_lib_examples / NatvieWindows.
You can find complete examples for iOS, Android and Windows Desktop/Tablet in this repo. Please read carefully README.md for detail instructions.