I would like to access the camera on an Android device (hopefully its the same for iPhones too). I'm currently writing a pure javascript application (no Ruby) using RhoMobile's 4.0 API. I've read in the docs that the Camera API has not yet been ported to 4.0, so I have to access via the 2.2 APIs. This is where I start to get lost. I believe I have all the necessary files included for the 2.2 API access via javascript:
build.yml:
extensions:
- rhoconnect-client
- rho-javascript
capabilities:
- camera
index.html (main page):
<!-- required for pre-4.0 JS API -->
<script type="text/javascript" src="/public/jquery/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="/public/jquery/jquery.json-2.4.min.js"></script>
<!-- pre-4.0 JS API -->
<script type="text/javascript" src="/public/js/rho_javascript_api.js"></script>
<!-- compatibility layer -->
<script type="text/javascript" src="/public/js/rho_common_api_noconflict.js"></script>
<!-- new Common JS API -->
<script type="text/javascript" charset="utf-8" src="/public/api/rhoapi-modules.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/jquery/jquery-1.9.1.min.js"></script>
.....
<div data-role="content">
<form action="" method="post" id="findingForm">
<button type="button" id="photoBtn">Add Photo</button>
<button type="submit" id="findingBtn">Submit</button>
</form>
</div>
application.js:
$('#photoBtn').on('click', function(e){
Rho.Camera.choose_picture(function(params) {
console.log(params);
});
});
When I click the button above, I receive the following errors in adb logcat:
I/APP (15917): I 02/11/2014 11:53:57:639 00003e42 HttpServer| Process URI: '/app/RhoJavascriptApi/command_handler'
I/APP (15917): E 02/11/2014 11:53:57:639 00003e42 HttpServer| The file /app/RhoJavascriptApi/command_handler was not found
E/Web Console(15917): Uncaught SyntaxError: Unexpected token < at http://localhost:44326/public/index.html#findings:1
It seems like the javascript code is looking for a Ruby controller or something along those lines? Or I'm completely missing something. Any help is greatly appreciated!
Device: Getac Z710 (tablet)
Android: 4.1.1
-Mark