A Cycling & bikes forum. CycleBanter.com

Go Back   Home » CycleBanter.com forum » rec.bicycles » Unicycling
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Writing native Android applications with Javascript? Not yet.



 
 
Thread Tools Display Modes
  #1  
Old March 15th 12, 05:46 PM posted to rec.sport.unicycling
softwares
external usenet poster
 
Posts: 3
Default Writing native Android applications with Javascript? Not yet.

The number of people using Linux (and I mean Linux the kernel) and
free software in general has exploded in the last 2 years thanks to
Android and Google. Even if you want to discard phones and only count
the tablets (which are starting to get very close to laptops in terms
of what you can do with them), the number of new users is huge. And
yet, we are all hostage of a choice -- a bad choice, in my humble
opinion -- that Google made: Java.
Why Java?
http://sapientarticles.com/soft/
Reason #1: Android came with Java! To be fair, it wasn't Google's
choice as such: Google bought Android in 2005, and I can only suspect
that Android was well entrenched in Java at that point.

Reason #2: In 2005, Java was still pretty much your only choice if you
wanted to write applications once, and expect them to run regardless
of what CPU you used.

Reason #3: Java was (and is) well known and widely used.
It's all about timing

In 2005, it probably made a lot of sense using Java. So, what has
changed? Two words: 1) Chrome 2) Javascript I am convinced that Chrome
and Javascript changed the whole IT landscape radically. Mind you,
Chrome beta was released in September 2008. The first version of
Android would be released a couple of months later (!). While Android
was being created, Chrome simply wasn't around.
http://sapientarticles.com/soft/
What's so important about Chrome?

Chrome came with the v8 Javascript engine. V8 is a monster of a
virtual machine, able to get Javascript code and make it spin really,
really fast -- faster than the speed of light. With Chrome, Javascript
turned: it went from being a sluggish scripting language, to being
something that could be used for real applications. Google was
interested in a browser that people could use to run their emerging
online applications (Google Docs was around in 2006). I am not sure
they realised that they could push Javascript to run that fast --
maybe it caught Google itself by surprise.
http://sapientarticles.com/soft/
In the end, if Google had to decide how to build Android in 2008
rather than 2005, I have little doubt that they would have picked
Javascript as their language of choice. Instead, Android has fully
embraced Java -- although they tried to bypass some of the patents and
issues with Java by using Dalvik. At the moment, to develop an Android
application you write Java code, compile it into a .class file (Java's
compiled code), and then convert that .class file into a Dalvik file
(which will be then interpreted by Android's internal Dalvik virtual
machine).
Is it too late?

At the moment, if you want to write an application for Android you are
pretty much stuck with Java. There are ways around I must say: one of
them is Phonegap which is released under a free license and is indeed
very exciting. PhoneGap is essentially a browser application that will
contain your code, written as HTML/CSS/Javascript. Whatever you create
is not native: it's a custom browser that has access to the device's
hardware, and that runs your web-like code.

What about native Applications?

You could convert Javascript code into a Java class using Rhino.
However, things are not easy: the Dalvik virtual machine doesn't work
nicely with dynamic languages . It's a pretty messy business.
The possible solutions
http://sapientarticles.com/soft/
Since Google is about to include V8 into Android 4 (or so it seems),
we would have a situation where your phone would include two very fast
virtual machines (Dalvik for Java and V8 for Javascript), but you can
only write native applications for one of them.

My idea is that Google should provide, natively, a bridge between the
Dalvik world and the Javascript world, so that it is finally possible
to write native Android applications using Javascript. This can be
done two ways: the obvious way is to make Dalvik work with Javascript
code. To me, it's looking less and less likely that this will ever
happen.
http://sapientarticles.com/soft/
The other option is quite involved: it would require Google to make it
possible to have native applications written in Javascript, and allow
them to access the system libraries (System C library, Media
Libraries, Surface Manager, SGL, LibWebCore, 3D libraries, FreeType,
SQLite) from Javascript. You will also need the Java.hardware classes
(in Javascript). This way, Native Javascript applications wouldn't
come with an overhead as big as a full browser for a start (there
would be no need, since all you are using is the V8 virtual machine,
like Node.JS did).
http://sapientarticles.com/soft/
Am I dreaming? Maybe. I wonder if I am the only one who thinks that
being locked to Java deserves a solution -- a real one.
http://sapientarticles.com/soft/
Ads
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing native Android applications with Javascript? Not yet. softwares Unicycling 0 March 15th 12 05:44 PM
What is native and what is exotic? VtSkier[_2_] Mountain Biking 1 April 28th 10 04:15 PM
Best Android apps DoTheHustle Australia 2 February 28th 10 09:37 AM
Mention unicycling on college applications? tennisgh22 Unicycling 15 January 12th 05 07:53 PM


All times are GMT +1. The time now is 03:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 CycleBanter.com.
The comments are property of their posters.