Is Java the best language for Mobile App Devlopment? - java

I was wondering what are the benefits of using anything else but Java for Mobile Application Development.

I do think that yes, Java is the most common language for devices, with two exceptions:
Windows mobile applications, that are frequently built in C++ but that will be built more on the .NET framework in the future.
iPhone applications, that use Cocoa and Objective-C.

Java is the most ubiquitous and for that alone it is your best choice.

You have to use whatever the phone vendor(s) that you intend to support will provide. As most provide Java, but only some provide other things, if you want to support a range of handsets, you probably need to use Java for at least some of them.
Your client (be they internal or external) will need to decide what handsets to support, and you then need to base your decision on supported handsets.
It's not entirely impossible that you'll have to ship versions in different programming languages, which may make code reuse more "challenging". It all depends on your requirements. Nobody on this site can tell you what they are :)

It really depends on what you're trying to do.
Java, whilst ubiqutious does have speed disadvantages. Also it's not "write once, run anywhere" as it is on the desktop space, as different manufactureres, even different devices have different sub-sets of java installed each with differening inclusions of APIs.
Using native code is going to be more efficient, whilst more difficult to port. It provides a more direct representation of the devices capabilities without the sandboxing of a VMs Apis.
Alternatively, you could use a language like C which whilst isn't strictly portable, will have implemenations on many devices with minor tweaks to make, whilst retaining a lot of the speed beenifts of such a language. (OpenC on S60/Symbian), C on Palm etc.

It depends on what you see as the future of the the mobile space. If the iPhone turns out to be as popular as the iPod, then no, Java probably wouldn't be the best choice.
One thing to consider is that at some point there may no longer be such thing as an iPod Nano, perhaps the Touch will be the only iPod available. In that case, every single iPod out would support Apple's iPhone OS and the number of iPhone OS mobile devices would far exceed those of Java.
Five years from now perhaps "Cocoa vs. Android" will be the new Mac vs. PC. In that case, Java could be just as good as Cocoa.

The only reason I can think of is that you wouldn't need a Java runtime on the target device.
Palm, for instance, allows you to code in C and talk directly to the OS routines in ROM. The C code compiles directly to the machine language without needing a runtime.

before one can provide a speculative answer to such a trivial question there are other variables that need be answered. What kind of phone application does one want to develop.
e.g. you can use xhtml for something that does not need to connect to the phones' core features.
and when you need to connect to the phone software or hardware you have can use java,python,c++,windows mobile or the new kid on the block android.

Java is the best if you want to support multiple phones, however J2ME is a limited environment. If you are doing homebrew development then develop for whatever your own phone uses, for commercial development then Java is the most widespread (and there are companies that can port Java to other platforms).

One of the advantages of using native code is your are closer to the hardware, on a mobile phone this means you might be able to take advantage of features which are not exposed to the virtual machine upon which your Java application is running, the promise of Android is that everything is a lot more exposed that it is with a typical Java Mobile implementation

Best is to go to nokia, apple microsoft or google web sites or whaterver and see what developer tools and resources are available and choose the one you want to develop for all of them are very good as good mobile app developers can help increase their market share.

Depends on what Application you are trying to write.
If its a simple service / data provider I would use HTML and CSS via a framework like
jqTouch, jQuery Mobile, or http://www.sencha.com/ as these will run on mostsmart phones and you can package them into a binary app using something like http://www.phonegap.com/ this will allow for sliding, GPS, local file storage using HTML5
If you need to a database, motion sensing, bluetooth, game type application then you could look at
http://monotouch.net/
http://monodroid.net/
That lets you write c# .net code and deploy onto any platform do you should be covered for windows mobile, android and iPhone.
There is also http://rhomobile.com/ that lets you write applications for all mobile platforms using Ruby.

Related

can i develop a multiple platform project -windows/Android- entirely with a single cross-platform language?

as i'm still learning, i'm not sure what tools, frameworks, even languages i'm gonna work with..
so i'm working on a simple project that got windows side and android side.. that obviously needs at least 2 languages to get it done, but it's impossible that i can learn those languages and know how to deal with their frameworks to get the job done
so is there a language i can develop the entire project(windows & android) with, and without need to any other language no matter what or how many tools or methods im gonna use to make it work?
-note: i know java is essential for the android side, so that's the point im talking about.... "entirely"
I would recommend you giving a loot at Flutter, it's not like native windows but it can produce applications for Android, iOS and web with a single codebase. It's really intuitive to use and the apps built with it work really well.
You can also take a look at React Native expect you need a Native app that you have to use Java as the core language if not give a trial to this
I notice you've tagged this with C#. To answer your question: that. You can write Android apps in it as well via a library called Xamarin that Microsoft bought out and has integrated into the platform.

What environment is more portable QT or java and which do you suggest using for my application needs?

I want to wrap a website and create an application around it (kind of like the iPhone/iPod Facebook app) and i want the application to be as portable as possible so with a very few modification to the code it can run on pc, mac, iPod, android or any other.
I know that Java is known for it's portability but i dislike it and i don't know about QT.
I know this question is quite subjective but can you give me a couple of opinions and reasons for them any way?
Thanks in advance,
Dante
Qt is portable enough for the major platforms (Windows, Linux and MacOS). It has the advantage of being native code, so no virtual machine is needed. And it provides rich graphics and other powerfull features, and the GUI look and feel of the specific platform.
If you are considering the same code base to be shared between desktop and mobile platforms, think again. There are different constraints in terms of resources, screen dimensions, etc. Qt can be used for some mobile platforms (mainly Symbian, Maemoo), Java for Android and ObjectiveC/C++ for iPhone/iPod. So a cross mobile platform application using the same technology is not feasible (at least for the moment).

Generic Java mobile development

I'm working in a Java-oriented shop and we're starting to adapt our products to mobile devices now (mainly focusing on smart phones). A separate native app is already in the works for the iPhone, but we would like to make a generic Java/J2ME version for any other devices.
My question is, how feasible is this? And where is the divergence point generally? ie We don't mind if each device has some variation in it's specific Java toolkit and they require separate builds, and thus all we can have is just have some basic framework stuff in common underneath. We're just trying to architect this in such a way that as much of the basic framework can be re-used as possible.
The main target platforms we're looking at are Android, Symbian, and generic Java-enabled mobile devices.
Anyone have any advice, pointers, or good links they can point me at?
The biggest divergence point will be the UI. You will need an entirely seperate UI for an Android App vs. a J2ME app.
If your app does not depend on any hardware components, client side databases, etc. you should be able to reuse any other data model/ backend processing classes.
In my work we have a common Java code base that is used in J2ME, Android and BlackBerry and we have had to address some significant issues:
As Mayra says UI will be huge difference, so you are better off having different UI layers for J2ME and Android.
To make it compile for J2ME you will have to make your common code Java 1.3 compatible. This requires careful design, and nightly builds that compile for each of these platforms.
Because of the above reason we found it a good idea to write your application/game module in Java 1.3 compatible mode.
It also helps if you have a good release management system, because you now have common code for multiple platforms, so, versions, release planning, branching code and its impact on release, all these can become a major headache without careful handling.
If you are planning cross-platform compatibility in modules like C++ and its compatible Java application engine then do yourself a favor and write modules in human understandable format, for example write SaveData class, instead of SaveToRMS in J2ME and SaveFile in Symbian. That way you are encapsulating platform dependent implementation while making it easier for the developer to know whats happening in the class.
Lastly, know that it will take about 6-9 months for a framework like this to mature, so be patient, and good luck.
Well, if you build a web application, all you can do is to do some modifications to adapt it to mobile browsers (if you design it well, there will be only css modifications).
Since you're talking about a shop, it makes totally sense to be online.
I would follow this path.

How to communicate with a USB device under Windows and Java?

I'd like to communicate with a USB device under Windows and Java but I can't find a good library to do so. I don't want the user to have to install any extra hardware or device drivers to make this work. That is, I want to be able to interact with USB just like other Windows applications do.
I am familiar with jUSB and JSR 80 but both seem to be dead projects (at least for Windows).
libusb-win32 requires you to install their generic driver, which then makes a USB device available to you. I'm not sure that it's possible to do driver-less access of an USB device unless the device belongs to one of several standard classes (storage and HID, in particular).
There is a Java wrapper for libusb-win32 which might work for you. I haven't used it myself, though.
I did quite a bit of research on this some time ago, and the unfortunate fact was that all the useful free USB+Windows+Java projects were dead. There is commercial and expensive (price $39.99 is not per developer, but per copy of your software sold!) JCommUSB library which probably works, although I have no experience of it; we had to build our own custom C wrappers to the USB drivers and communicate with them through JNI.
The fastest and easiest way is to hack some native code :)
I wrote a small wrapper for HID devices that enabled my Java applications to read data from CalComp digitizers, so it's definitely doable and not too hard. The bad thing is that my work is still proprietary code owned by my former employer, so for legal reasons I can't release that as open-source -- yet.
The good thing is that you can get a flying start with the HID example code from the Microsoft DDK :)
Communication between Windows and a USB device by java.
http://javausbapi.blogspot.com/2010/05/java-usb-api.html
An example is conducted for a Freescale microcontroller

Suggestions for an embeddable scripting language for iPhone and Java app?

I'm developing an app for iPhone with a Java desktop companion that it synchs to over the network. I'd like to embed a scripting language into both apps so that end users can write scripts that add new behaviours and interact with the object model, and so that I can more rapidly develop some features.
Any suggestions for this, or anyone done this before and got experiences to share? I'm thinking of something like tcl which I've used in the past, but not tcl itself as I'm not a big fan of the language.
Main criteria are that it should be
lightweight as poss (memory usage)
easy to interface and extend with java and objective-c
(nice to have) readable/approachable for people with limited programming experience
My initial hunch is that I should be using one of python, ruby, or lua. My preference would be ruby, as I already have some experience with it and don't know much about the others. However my main unknown is which of these is easiest to get integrated with iPhone and Java.
edit 2: per Jason Coco in the comments, the SDK terms prohibit embedded scripting languages. Checking into this it does indeed seem to, but I read it to preclude dynamic installation and extension only. I would still be interested in answers here, as the agreement doesn't seem to preclude having prepackaged scripts inside the application bundle itself - Apple would still get to vet that code.
The agreement also seems to allow use of Apples "interpreters"...what are these? Javascript and what else? Any route to use those here?
JavaScript
As I understand the iPhone SDK Licence, there is nothing preventing you from using a scripting language in your app - just that you cannot intall any interpreters or runtimes of your own. You can only use those scripting languages for which Apple provides the interpreter in the SDK.
Given that you want to run the same scripts in your iPhone app and in a Java app, the obvious choice is JavaScript. You can use Apple's APIs in your iPhone app, and something like Rhino (http://www.mozilla.org/rhino/) in your Java App.
You have to be aware that there may be slight differences between the two interpreters in the more obscure regions of syntax or object model.
P.S. I assume that users are going to be writing their own scripts to run on their own device/desktop. These would be part of the application data, and should be fine under Apple's licence
The only thing I've seen that allows a non-objective-c/c/c++ application to run on the iPhone is Unity3d (http://unity3d.com/unity/features/iphone-publishing) - BUT, it uses C# via Mono and does a full static compilation (http://tirania.org/blog/archive/2008/Nov-05.html) down to native code in order to do it. So, by the time the app is on the phone, it's no longer C# so it's allowed by Apple (and several apps have already made it into the App Store - so this does seem to be acceptable).
I don't think you would be able to do the idea you're talking about even if you could do the equivalent for Java/Ruby/Lua/Python/other (so having your desktop app pre-compile and upload just the native code to the device). As far as I know, you can't execute code outside of your application bundle...and if you modify the application bundle, then you invalidate the codesigning Apple does which allows the app to run on your phone in the first place. So even if you could get executable code to the phone, I'm not sure that you would be able to run it if it didn't come along with the app in the first place.
I was researching this too, and it seems that it's possible to pre-compile a Lua script (by converting it to C using Lua and then compiling the C file). Because all of your code could then be part of the application bundle (including the embedded Lua interpreter), it should be acceptable as an iPhone app.
See here for a discussion and sample script:
http://lua-users.org/lists/lua-l/2008-11/msg00453.html
*Note that I haven't tried this (yet)

Categories