how similar is the language used for android SDK to java? - java

is there a point starting with java basisc or should I go for android-based examples and tutorials?

They are basically the same. But, I recommend going with android based examples since android has unique app cycle and app format.

Android SDK is build in and using Java.
They are for all intents and purposes the same.
However Android is coded using it's own specific library methods and syntax, hence it's a better idea to skip directly to Android. Knowing Java makes it easier but is not a necessity to code in Android.
You will require the JDK since it does need Java to run.

Related

Android VoIP call implementation

First of all I'm a newbie in VoIP implementation. I need to implement VoIP single and group call in android application. Could you tell me, what is actually the best way to achieve this ? I'm looking for Android SIP library (probably open source) which should:
has good documentation with simple app examples
be ready to use with java
Maybe just native android SIP api will be the best ? But I heard that it doesn't support group calls.
Most of the voip libraries use C/C++ implementation for various reasons. You can use PJSip which is a C voip/sip stack. It has a good documentation but you have to build it yourself using android ndk . It has good documentation and also contains processes to build it for Android and other platforms. But there is no java/android wrapping built in so you should do that yourself. Another option is Liblinphone which is also based on C stack but provides all of the wrapping and implementations out of the box so you don't have to bother so much on native codes. It also has a sample application which you can try yourself. One downside of Liblinphone is that it lacks proper documentation and you have to dig in more.
Regarding the android SIP api, I don't think it is a good option as it has much more limitation and hardly maintained. It is based on Jainsip stack which is a 100% java stack but is too verbose. I personally would like to recomment Liblinphone as I am currently implementing it and am pretty satisfied with it. Best of luck...
Update
Here is the source code of linphone for android if you are interested in it. You can get pretty much idea of Liblinphone for android from it. You have to dig much more into the sources though.
You can have a look at Restcomm Android SDK:
It's open source, with an active community around it
It using SIP for signaling and Webrtc for media so should work nicely with NATs, etc
Comes with 2 sample applications that you can play with and alter their code to experiment
Comes with quick start guide, reference doc
You can check the Olympus sample App right away by installing the .apk from this link
Notice that the SDK doesn't support group calling out of the box, but you could combine it with Restcomm-Connect open source platform to add such functionality very easily. Restcomm-Connect also comes with docker, so you should be able to install it right away.
Please let me know if you have any questions
Best regards,
Antonis

Python for Android Apps

I've learnt python recently and I want to make an app for android. But everywhere on the net, it seems Java and Eclipse are the only ones that can be used.
So, my question is:
1) Can I use python to make an android app?
2) What kind of platform should I use to make an app with python?
Thanks guys!
If you're just looking to run Python scripts, try QPython.
If you're looking to make your Python code run like a native app, or just something more robust than the above, try SL4A.
If you're looking to effectively use Python as a library, and compile an .apk with the Python library included, try Kivy: github.com/kivy/python-for-android.
That said, you'd likely get a lot of benefit from learning Java, and not just for programming natively in Android (which would give you access to a much wider feature set and make your app run more efficiently).
Check out the Scripting Layer For Android, aka SL4A.
Here is a blog for getting started. The blog promises more entries in the series but there don't seem to be any. Still, it is a great starting point. There's quite a few parts to pull together so be patient and check the bottom of that blog entry for dozens of useful links.
If you want to contain everything to the Android device, including the IDE (pretty slick), check this out.
Here's a book from APress that could help with more advanced concepts: Pro Android Python with SL4A

Difference between Kivy and Java for android apps

I'm a python developer with little experience creating android apps in java and want to create an app that will access my university web portal, retrieve some data and show on a view.
So, after researching Kivy, I have a few questions:
1) Which one is easier and faster to develop android apps?
2) Does Kivy have any android feature limitations?
3) And finally, would an android app developed using kivy run as fast as one developed using java?
This is a rather subjective question.
1) Which one its easier and faster to develop android apps?
I think there's a strong argument for kivy, but this doesn't have an objective answer.
2) Does Kivy has limitations to access certain parts of android (like not fully integrated with its api)?
The kivy project includes pyjnius, a tool for accessing java classes through python, and in principle I think this should give arbitrary (edit: on reflection, not arbitrary, but probably not limited in immediately important ways) access to the java apis.
In practice, prebuilt python wrappers are a work in progress, though rapidly improving. The android python library already gives easy access to many things (including but not limited to intents, vibration, accelerometer etc.). Even where there isn't already a python wrapper, it can be very easy to do the necessary work.
Edit: There has recently been great work on Kivy's plyer project, intended to provide a transparent api to platform specific tools so that you can call it once and get the same behaviour on different systems without knowing about the details. It includes useful support for parts of the android api.
3) And finally, an android app developed using kivy would run as fast as one developed using java?
Ultimately the answer is probably no, but the difference is highly unlikely to be important unless you're doing something strongly cpu limited. The task you suggest would not be limited in that way.
To complete inclement's answer, pyjnius indeed allows to access a lot of the android api. But it's not perfect, calling existing classes is not always enough, and an android programmer often need to create code that will be called by android to manage events, there are two ways to do that, both used by the android api.
The first one is interfaces: you need to create a class that implement an existing java interface, pyjnius can do that, you create a python class and declare which java interface it implements, and have a decorator to declare the methods you have to declare.
The second is subclassing, you need to subclass an existing java class and override some methods, and we don't have a way to do that with pyjnius yet, so for these ones, you'd have to create a java class and use it in your program (fortunately you can mix that with kivy/pyjnius, it's just can't be 100% python in that scenario).
So it can be worth a look to the api beforehand, to see if the parts of the android api you have to access requires that.

OpenFeint with cocos2d-x (iOS and Android)

Apparently OpenFeint supports both iOS and Android. Great.
But how do I integrate it with cocos2d-x Android? The SDK is, apparently a .jar and such. Cocos2d-x uses c++.
I don't get this tutorial: http://blog.molioapp.com/2011/11/openfeint-and-admob-integrated-with.html
I copy & paste the code and immediately I get errors (JavaVM *gJavaVM;? There is no identifier called that way!)
Are there any other steps not mentioned in that tutorial I missed?
Yes. In order to build a C++ library for Android you need to use the NDK. Getting that set up is pretty involved so I am just going to link you to a separate tutorial that has already covered it.
http://developer.android.com/sdk/ndk/index.html#installing
That is the Google documentation on getting up and running. There are other resources for this as well if you have trouble.

Starting with Android: Java or Python (SL4A)

I just ordered an Android smartphone and want to start playing around with creating my own applications. Now the question is which language to use, the native Java or Python using SL4A (former ASE).
I tend to Python, as I know it much better than Java, but I'm wondering what I would be missing using a "second class" language on Android. On the SL4A website it is also stated to be alpha quality software, which is not exactly encouraging.
I'm also not quite sure what the limitations of the scripting environment are and if they would be problematic.
At the moment you cannot create a releasable program with Python (or any other scripting language) using SL4A. I have heard rumours that this is something Google is working on, but even if they do enable it Python apps are likely to be slow and power-hungry compared to Java. Also the scripting API only gives you access to a limited subset of the native Java API. I would not consider using SL4A for serious development work at the moment, only for one-off scripts and prototyping.
Take a look at Scala. It is a statically typed language on the JVM, but uses type inference to remove most of the noise that you get in Java. It also fully supports functional programming, and has a lot of pythonish features. Because it is statically typed it is as efficient as straight Java with none of the disadvantages. IMHO it is the language that Java should have been in the first place.
A lot of people are blogging about using Scala on Android, so Google around for more information.
More likely will depend what type of applications you will develop.
I would start with Java to become familiar with Android SDK. Anyway first you need to look into some examples, tutorials. Most of them are done in Java, and only a few, probably on the dev site of SL4A for that.
Also there is native development Android NDK, that can be programmed with C++.
But anyway Java rules for general applications.
Adding an update to Dave Kirby's answer:
Issue 55, Distribute scripts as APKs, in the issue tracker at SL4A deals specifically with that.
There is a solution being worked out (may be complete by now) described at SharingScripts. The only issue seems to be that you need to have a interpreter APK already installed.
you may want to check out Ruboto it is a framework for developing Android apps based on JRuby which means your JRuby code can call Android APIs and can also be called back from the Android Java side.
Here is an introduction article .
Consider ising Kivy, if you want to write Android apps with Python. The process of packing script to .apk file is described here.
The problem is, resulting .apk will be big (~7Mb for 300Kb data). It is obvious, because you need to pack there Python runtime and all libraries.
Another solution I have heard of, is Pygame for Android, but it works on lower lewel, so you need to draw graphics manually.
Unfortunately, I have not tried any of this ways yet, but it looks, that I'm going to start using kivy soon.

Categories