Sign in to follow this  
Followers 0
Patriarch K

How to use Java application on Android

5 posts in this topic

This is something that I'm wondering about at the moment and I know that it's pretty much a beginners question, but do I have to do something with the code? How am I supposed to do? I want for example my application to be able for downloading on the internet on my own home page. Am I supposed to have a .jar-file to do this or something?
In short - how can I use my Java app on my Android phone.
Any advice?
0

Share this post


Link to post
Share on other sites
The app needs to be built targeting the platform.

There is a [url="http://developer.android.com/training/basics/firstapp/index.html"]tutorial here[/url] with links to instructions on building your first app, and also with links to the tools you will need.
1

Share this post


Link to post
Share on other sites
android does not run java. It runs dalvik. For all intents and purposes dalvik is basically java (source code is the same etc) but they aren't compatible. Dalvik also compiles to a .apk not a .jar. Dalvik bytecode is altered from standard java bytecode in order to be more efficient on mobile devices, there were some pretty fundamental changes though so java bytecode will not run on a dalvik VM or vice versa.

Most handsets if you just stick a .apk on the SD card or internal memory somewhere (downloaded from dropbox, mediafire, wherever) and then find it in the file browser will install the .apk to the device and add it to the app screens as normal. Some cell operators distribute handsets with branded firmware which may disable this functionality however that is very rare (I have come across one HTC handset on the vodaphone network with it removed).

So really if you want to bypass the play store entirely you would compile your application to a single .apk file. Stick it on a file sharing service. Users would find it in browser, it would be downloaded into their downloads folder on their SD card. When they tap it on the SD card it will prompt for install, they click yes, it installs it, done.

Most people just use the google play store as 99% of users rarely venture outside of it to obtain their apps.
1

Share this post


Link to post
Share on other sites
Soo...I don't really need to follow the tutorial that frob linked me to - I can instead use my finished code piece and compile it with something else in short? :)
0

Share this post


Link to post
Share on other sites
[quote name='Patriarch K' timestamp='1351897727' post='4996694']
Soo...I don't really need to follow the tutorial that frob linked me to - I can instead use my finished code piece and compile it with something else in short? [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
[/quote]

The application model is quite different as well, Android apps are not written in the same way as normal Java apps.
0

Share this post


Link to post
Share on other sites
Well your existing java application will use libraries not available on android. You can't just change a compile setting. A full port will need doing although a fair amount of program logic will be re-usable.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0