What is the difference between Smack and aSmack?
Asked Answered
P

4

13

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?

Punctilious answered 14/10, 2010 at 12:49 Comment(0)
G
12

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

  1. Disabling XMPP SASL auth methods that are not supported on Android
  2. 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

Granoff answered 22/3, 2013 at 16:48 Comment(6)
if you don't mind, can you give a reason or some details on why this doesn't happen? Basically Dalvik can run standard java code right?Liven
Thanks a lot! I was at a loss on why I couldn't use Smack... Thanks!Liven
If you find this answer helpful, then please consider upvoting.Granoff
Could you help me with one more thing... Is this the reason why asmack comes in different jars for different android versions? Any specific reason? Why can't the same jar be used?Liven
ATM the only difference between the aSmack versions for different Android API levels is that they are build with the android.jar of this levels. This does not result in any functional differences and, as the time of writing this, it should make a difference which one you use.Granoff
So if one builds for 4.0, it will be forward compatible with future version of Android? My understanding is that, for example, if you make an app with standard API for say 3.2 (Honeycomb), it would work until the API's are deprecated. So if I use the asmack release for 3.2, it would work for all devices after that, provided any API's weren't deprecated?Liven
T
5

As the project description states, ASmack adds a set of patches to regular Smack. Check this conversation for further details.

Regards.

Tye answered 14/10, 2010 at 22:22 Comment(1)
What i wanted to say is that i have the source code for both smack and asmack but the code doesn't have any difference as such that smack shouldn't work on android.Which patch or what thing stops smack to be used on android and enables asmack to work fine on android?Punctilious
U
1

You can see how things are done in talkmyphone. I think they are using smack with android.

Uranalysis answered 14/10, 2010 at 13:8 Comment(1)
IIRC talkmyphone uses the pretty old smack patch from here: davanum.wordpress.com/2007/12/31/… with that diff: people.apache.org/~dims/android/smack-android.diffGranoff
L
1

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.

Laevorotation answered 8/8, 2011 at 16:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.