Firefox OS - Native Access

765 views
Skip to first unread message

Chris Molozian

unread,
Jan 28, 2013, 11:11:33 PM1/28/13
to dev...@lists.mozilla.org
Hey all,

I'm just starting to experiment with Firefox OS and all the developer
tools / documentation available at the moment. I understand the design
goals for the project and its focus on using web technologies as the
technology stack for developers to build their applications with but I
want to know if there's plans to provide a native API at some point?

Android provide the NDK
(http://developer.android.com/tools/sdk/ndk/index.html) which makes it
easier to integrate existing C and C++ libraries into mobile
development. Is something like this on the roadmap for Firefox OS?

For example, let's say that I wanted to develop a Firefox OS wrapper
library for Riak Mobile
<http://www.infoq.com/presentations/Bringing-Riak-to-the-Mobile-Platform>.
It's a software library written in C++ that uses the SQLite database
available in the handset APIs and allows data to be synchronized in a
controlled way between a mobile device and a Riak
<http://docs.basho.com/riak/latest/references/appendices/concepts/#What-is-Riak>
cluster. Now because the code is written in C++ its been wrapped for
Android using the NDK and is accessible via C on iOS.

As far as I'm aware if I want to add support for Firefox OS to that
project I'll actually not be able to make use of the library at all.
Instead I believe I'll need to port the entire codebase to Javascript
and use the HTML5 Local Storage <http://diveintohtml5.info/storage.html>
API for the data storage layer.

Is my current conclusion correct?

Cheers,

Chris

Dale Harvey

unread,
Jan 29, 2013, 2:57:13 AM1/29/13
to Chris Molozian, dev...@lists.mozilla.org
I would very much suggest using indexedDB over localstorage, but the rest
is correct, indexedDB / HTML5 API's and JavaScript are the native API +
language

Cheers
Dale

On 29 January 2013 05:11, Chris Molozian <ch...@cmoz.me> wrote:

> Hey all,
>
> I'm just starting to experiment with Firefox OS and all the developer
> tools / documentation available at the moment. I understand the design
> goals for the project and its focus on using web technologies as the
> technology stack for developers to build their applications with but I want
> to know if there's plans to provide a native API at some point?
>
> Android provide the NDK (http://developer.android.com/**
> tools/sdk/ndk/index.html<http://developer.android.com/tools/sdk/ndk/index.html>)
> which makes it easier to integrate existing C and C++ libraries into mobile
> development. Is something like this on the roadmap for Firefox OS?
>
> For example, let's say that I wanted to develop a Firefox OS wrapper
> library for Riak Mobile <http://www.infoq.com/**
> presentations/Bringing-Riak-**to-the-Mobile-Platform<http://www.infoq.com/presentations/Bringing-Riak-to-the-Mobile-Platform>>.
> It's a software library written in C++ that uses the SQLite database
> available in the handset APIs and allows data to be synchronized in a
> controlled way between a mobile device and a Riak <
> http://docs.basho.com/riak/**latest/references/appendices/**
> concepts/#What-is-Riak<http://docs.basho.com/riak/latest/references/appendices/concepts/#What-is-Riak>>
> cluster. Now because the code is written in C++ its been wrapped for
> Android using the NDK and is accessible via C on iOS.
>
> As far as I'm aware if I want to add support for Firefox OS to that
> project I'll actually not be able to make use of the library at all.
> Instead I believe I'll need to port the entire codebase to Javascript and
> use the HTML5 Local Storage <http://diveintohtml5.info/**storage.html<http://diveintohtml5.info/storage.html>>
> API for the data storage layer.
>
> Is my current conclusion correct?
>
> Cheers,
>
> Chris
> ______________________________**_________________
> dev-b2g mailing list
> dev...@lists.mozilla.org
> https://lists.mozilla.org/**listinfo/dev-b2g<https://lists.mozilla.org/listinfo/dev-b2g>
>

Dale Harvey

unread,
Jan 29, 2013, 3:01:38 AM1/29/13
to Chris Molozian, dev...@lists.mozilla.org
I did forget to mention that you could experiment with emscipten to port
the C++ over to js

https://github.com/kripken/emscripten

Gervase Markham

unread,
Jan 29, 2013, 6:00:35 AM1/29/13
to Chris Molozian
On 29/01/13 04:11, Chris Molozian wrote:
> As far as I'm aware if I want to add support for Firefox OS to that
> project I'll actually not be able to make use of the library at all.
> Instead I believe I'll need to port the entire codebase to Javascript
> and use the HTML5 Local Storage <http://diveintohtml5.info/storage.html>
> API for the data storage layer.
>
> Is my current conclusion correct?

As Dale says, try Emscripten. That may well allow you to use the
existing C++ code.

I think I can say without fear of contradiction that there are no plans
for an NDK for Firefox OS - it would be antithetical to what we are
trying to achieve.

Gerv

Chris Molozian

unread,
Jan 29, 2013, 10:19:18 AM1/29/13
to Gervase Markham, dev...@lists.mozilla.org
Thanks for the prompt response, Gervase and Dale.

I'd not considered using emscripten I'll definitely look into it and
experiment with porting my C++ code using it's Javascript code generator.

Thanks for the advice. :)


> Gervase Markham <mailto:ge...@mozilla.org>
> 29 January 2013 11:00
>
> As Dale says, try Emscripten. That may well allow you to use the
> existing C++ code.
>
> I think I can say without fear of contradiction that there are no plans
> for an NDK for Firefox OS - it would be antithetical to what we are
> trying to achieve.
>
> Gerv
>
> _______________________________________________
> dev-b2g mailing list
> dev...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-b2g
Reply all
Reply to author
Forward
0 new messages