I am not able to use Smack on Android whereas aSmack works perfectly? When compared the source code it looks somewhat similar, where does the difference comes from?
What is the difference between Smack and aSmack?
Smack < 4.1 does not work on Android, mostly because of APIs missing on Android (e.g. most of the javax APIs). That is the reason the aSmack build environment was born. It is a way to modify Smack so that it can be used on Android.
Besides many minor changes the biggest changes are
Disabling XMPP SASL auth methods that are not supported on Android
Using apache harmony for SASL instead of the javax API
Make sure to read the README and and init the relevant code before doing any XMPP related actions.
More information can be found # https://github.com/Flowdalic/asmack/wiki/Modifications
As the project description states, ASmack adds a set of patches to regular Smack. Check this conversation for further details.
Regards.
You can see how things are done in talkmyphone. I think they are using smack with android.
It modifies Smack to allow it to work on Android.
I am not sure of what those changes are, with the exception of altering the ProviderManager mechanism so that it can load the smack.providers XML file from an Android friendly directory. By default Smack loads this from its own resource directory, which is not reachable in Android.
Related
I am creating an app showing local events for android. I was hoping to use the Eventful API, since that came with its own java-based client library. However, I'm not sure if it's fit for Android, since I know a lot of these java based client libraries use stuff Android doesn't support.
So, does anybody know if it works?
My entire project is available # github if you want to check it out for yourself.
The API is found here.
Android does not have have issues with Java client libraries. It is build on top of standard Java, and can use all of the framework features.
Furthermore, it looks like this API offers a RESTful interface, which is for sure supported by Android.
Bottom line, I do think you can use this API in Android without issue.
I'd say the easiest way is to compile and run an application that embeds the library and tests a few methods.
Typically, you may have issues with the way the networking is handled. There are 2 main ways in android to do HTTP, the Java and the Apache way, I think the Java URL API is fully supported and very close to the actual Java version, but the Apache has some hidden differences.
The main risks you'll have are A/ that it uses classes or packages that are not present on Android. B/ that a class does not behave as expected, which does happen from time to time, as the Android implementation is entirely specific.
Apparently you have already tried to run an android app with the library included? Did you encounter a specific error? If you, can you post the stacktrace?
In Eclipse:
Is it possible to Sharing code between GAEJ and Android projects? And or GAEJ and another GAEJ?
Thanks
there was a nice talk about GAE & Android integration on the last GoogleIO 2012:
Google I_O 2012 - Building Mobile App Engine Backends for Android, iOS and the Web
they show how to use same data structures for data exchange between Android and GAE.
If you asking about how to set it up in Eclipse, I use the 'linked source' option in the source tab of Java Build Path. Here's a blog post with details:
http://blog.christoffer.me/2011/01/sharing-code-between-multiple-java.html
If you are asking about whether it is practical - from the code perspective - that is trickier.
When trying to share Android code with GAE/J I discovered that I had dependencies on android packages, e.g. android.util.Base64. Sharing code means dropping stuff like this and using 3rd party libraries instead. For example, the Guava library works on GAE/J and Android:
http://code.google.com/p/guava-libraries/
Logging is another problem. My GAE/J code was writing to java.util.logging.Logger, whereas my Android code ultimately logs to 'android.util.Log.println. If you use a common library framework like log4j or just writing to System.Out I think you will lose functionality in the log viewer - ideally you would have a logging library or shim that mapped to java.util.logging.Logger or android.util.Log.println depending on the platform.
I want to communicate with Apache Tomcat server using android ndk(native code).
Is it possible to communiate , Is there any other alternative to do so ?
Thanks.
Standard POSIX socket code can be used for networking in Android. The socket system call api for android can be found at https://github.com/android/platform_bionic/blob/master/libc/SYSCALLS.TXT (this is a clone of the official android C library repo). This should take care of your network layer requirements. As for the code, the code for a simple network client can be found at http://en.wikipedia.org/wiki/Berkeley_sockets#Client. However, this is only in the case you want to write up your own application layer protocol( I assume HTTP) code. It is better to use an HTTP client library instead,.
As for an HTTP client library, you could use libcurl or any similar library for communication. A good list of available libraries on the libcurl site at http://curl.haxx.se/libcurl/competitors.html.
Note: You will most probably not get any compiled library. You'll need to compile and add the library into your application before you compile your code, and the library will need to be a part of the install package as well.
I recently wrote a Facebook Chat App for Android using Smack, which is an excellent library and it worked great for that app. I'm currently working on my next chat project on Android and would like to do BOSH, but Smack doesn't support it. I've found a development branch talked about here:
http://community.igniterealtime.org/thread/40768
I was hoping there was something out there that was more stable. Has anyone else found anything?
Thanks!
Every asmack fork I know contains the SMACKs BOSH patches. I have never used them, but I am also not aware of any alternative library that implements BOSH for the Android platform.
To produce custom jars which has got support for BOSH connection. These jars can be found at https://github.com/rajesh-kumar/amqp-xmpp-bosh/tree/master/lib/
I have searched alot on google and in here to find the best featured API for XMPP client.
I have found the following two:
asmack: .http://code.google.com/p/asmack/
patched smack: http://davanum.wordpress.com/2008/12/29/updated-xmpp-client-for-android/
I cant find any comparison of these two APIs on the internet, so maybe you can help me in which one to choose.?
In the original article of the patched smack he inform that TLS does not work (thats fine I should not use that) I consume that the rest works.
On the other hand asmack is very popular but when I read around the net it seems that it is a little more buggy?
What do you advise me to choose?
Thanks!
asmack is almost the same code as smack, basically what they did is some code refactoring, add some extra methods to extension, changed package order, also they replace DNS class and classes related with Sasl and authentication.
http://groups.google.com/group/android-developers/browse_thread/thread/0a8a0fb16752ba52/631dcf2137e79e7f?lnk=raot&pli=1
If you use asmack you wont have major problem.
I do recommend to Avoid asmack In our last project we faced so many problems due open issues :
http://code.google.com/p/asmack/issues/list
other alternatives are avilable:
https://stackoverflow.com/a/5487854/771300