Is it possible to use Camera API with free Rhodes 5.0.25 package ?

T Thierry Leloup 3 years 7 months ago
1 1 0

Hello everybody,

According to the Rhodes 5.0.25 API Summary (Rhomobile | RhoMobile API Summary) the camera module does not require a license and is usable in both RUby and Javascript.
The asterik indicates "Some API classes that may have been available in RhoMobile Suite 2.2 and have not yet have been incorporated in the new Common API class set for RhoMobile Suite 5.0.25, here these APIs are marked with an asterisk (*). However these APIs are still available in the 2.2 format but only in Ruby."

which is a first contradiction.

Then, I tried to use it with my free Rhodes 5.0.25 package with a simple Ruby call and "camera" added to the Build.yml extensions :

Rhosimulator : No error during the build (rake run:iphone:simulator") but a systematic error in Rhosimulator : GET http://127.0.0.1:59316/app/Demonstrator/testInfos 500 (Server error)
Real Android or iOs device : systematic build error (rake device:android:production) :
ext - camera
exception: cannot load such file -- camera
rake aborted!
Can't find extension 'camera'. Aborting build.

My question is then : is it really possible ti use the camera API with the free Rhodes 5.0.25 package or is the purchase of RhoElements (299$/month !) mandatory ?

Thanks for your help,
Thierry

Please Register or Login to post a reply

1 Replies

J Jon Tara

The Camera API is not yet available in Javascript. It uses the old 2.2 API style, and is only available in Ruby. It is included under the open-source license - no paid license is needed. For the Camera API, RhoElements will gain you nothing beyond what you have now. I use the Camera API in 5.0.25, and it works fine. You must use Ruby for now.

Unfortunately, when the basic documentation about Ruby and Javascript APIs was written, the Camera API was used as the "poster child". But, then, it was never implemented using the new API style. Oops!

I really urge all Rhodes developers to learn Ruby and use the Ruby APIs if at all possible. IMO, the Javascript API is a crutch in case you do not want to learn Ruby. It just adds an unnecessary layer of complication.

As well, Ruby code runs faster on mobile platforms than Javascript does, though that may seem counter-intuitive. That said, in most cases, there is not a lot of actual Javascript code being used in the Javascript versions of APIs. The Javascript code just hands the job off to the core APIs, which are typically written in a combination of Ruby, Java (on Android), C, and C++.

The code that you yourself write, will run faster if you write it in Ruby. If your code is just a bit of "glue" code, it will be of no practical consequence. If you write extensive code, it is better to do it in Ruby.

CONTACT
Can’t find what you’re looking for?