nurahmandani / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

Problems with pubsub #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

First of all I would like to thank you for the great job that you have done
by porting the Smack library to the Android platform, nevertheless I have a
problem with it.

The problem is related to publish/subscribe service of XMPP. In fact, when
I try to use publish/subscribe service on Android 2.1 with
asmack-2010.04.02.jar I get a ClassCastException, while if I try the same
code on the PC, with the smack from SVN (r11655), it works perfectly.
I have attached an Android class that tries to use the publish/subscribe
service by subscribing to a node as example (see nomeclasse.java). Also,
the Android log is attached (see Debug.rtf).

As you can see from the log the exception is thrown by the instruction:
eventNode = manager.getNode(PUBLISHER_NODE).
Do you have any idea to fix the issue? Am I doing something wrong?

P.S.: I left the crediantials to the server as plain text, to give you a
chance to use my OpenFire server. Please don't warry about the credentials
because it is a dummy account on a testing server.

Thank you,
Selene

Original issue reported on code.google.com by el3t...@gmail.com on 6 Apr 2010 at 3:24

Attachments:

GoogleCodeExporter commented 8 years ago
Asmack doesn't come with auto-registration for packet extensions. You have to
register the classes.

You may steal the code from
[http://code.google.com/p/buddycloud/source/browse/trunk/client/android/main/src
/com/buddycloud/jbuddycloud/BuddycloudClient.java#49
Buddycloud] or rewrite the
[http://github.com/rtreffer/smack/blob/master/build/resources/META-INF/smack.pro
viders smack
xml config].

Original comment by rtreffer@gmail.com on 6 Apr 2010 at 9:07

GoogleCodeExporter commented 8 years ago
I'm too incompetent at using the reply box, but the problem should be solved. 
Don't
hesitate to open up a new issue when you run into problem :-)

Original comment by rtreffer@gmail.com on 6 Apr 2010 at 9:09

GoogleCodeExporter commented 8 years ago
Hi rtreffer,
Are you going to add a patch to asmack that manually register all the packet
extension available on smack, so that other users of your library won't have to 
face
this issue?

Are there any drawbacks if I register all the packet extension, even if I don't 
use
some packet?

Does Buddycloud register all the packet extension or only a part of packet 
extension
of smack? 

Best regards,
Stefano "Kismet" Lenzi

Original comment by kismet...@gmail.com on 7 Apr 2010 at 9:02

GoogleCodeExporter commented 8 years ago
I'm trying to use only the needed extensions, as XMPP is mainly running as a
background service, meaning a memory leak might be fatal.

Besides that: I'm seeing several missuses of the lib, but I'll not try to solve 
all
of them in the lib. I'll try to create a simple sample app with all the bits 
needed.
This should help as a kickstartet for others.

Regards,
  René

Original comment by rtreffer@gmail.com on 7 Apr 2010 at 11:12

GoogleCodeExporter commented 8 years ago
Hi Renè,

Does it means that asmack aims at be a system Service and that android 
Application
(may I say Activities) should interact with asmack by means of Intent?

Original comment by kismet...@gmail.com on 7 Apr 2010 at 1:07

GoogleCodeExporter commented 8 years ago
It's just a lib. Which is "usually" used inside a service. The service writes 
to a
content provider, and activities that attach to these content providers.

That's the way most xmpp apps are modeled atm.

That said asmack is (right now) jast the xmpp library :-)

Original comment by rtreffer@gmail.com on 7 Apr 2010 at 2:05

GoogleCodeExporter commented 8 years ago
I downloaded last source from repository and patched, some patch manually.... 
but im 
getting the same problem..(CastException) in getNode.
How can i fix this ?

Original comment by one2one....@gmail.com on 15 Apr 2010 at 12:14

GoogleCodeExporter commented 8 years ago
As I've said you should track the connection process and make sure the 
pubsubmanager
is registered (together with the pubsub elements). I'm actually doing pubsub 
all the
time, for buddycloud. It's definetly working once the IQProviders are 
registered.

The ProviderManager must be able to resolve the pubsub items/namespaces. You'll
otherwise end up with a generic packet that can't be casted (obviously).

Have a look at this static bock on how to do it:
http://code.google.com/p/buddycloud/source/browse/trunk/client/android/main/src/
com/buddycloud/jbuddycloud/BuddycloudClient.java#45
You should register anything from the pubsub namespace and from
org.jivesoftware.smackx.pubsub.

This has to happen before you try to connect to the server.

Original comment by rtreffer@gmail.com on 15 Apr 2010 at 12:35

GoogleCodeExporter commented 8 years ago
Hi one2one,

I don't know if you resolved your problem but you can copy and paste the code 
that
you find attached to comment #14 of the issue #9 [1] to initialize ASmack to 
support
XEP-0060: Publish-Subscribe

Ciao,
Stefano "Kismet" Lenzi 

[1] - ASmack initalization for enabling support fo XEP-0060 -
http://asmack.googlecode.com/issues/attachment?aid=1025499906583360115&name=asma
ck.initialization.java

Original comment by kismet...@gmail.com on 22 Apr 2010 at 1:36

GoogleCodeExporter commented 8 years ago
Everytime I try to get a node, I get item-not-found. Even when I create the 
node before, and I get no errors.
Can you help me? Almost all the links that you posted are down.
Thanks.

Original comment by eng.prud...@gmail.com on 3 Dec 2011 at 5:32

GoogleCodeExporter commented 8 years ago
The above issue is resolved using the help i got from this site.

http://community.igniterealtime.org/message/201866#201866
use the code in above site to register all the providers

also Servicediscoverymanager was returning null which was causing problem

so i replaced

ServiceDiscoveryManager discoManager 
=ServiceDiscoveryManager.getInstanceFor(connection);

 with

ServiceDiscoveryManager discoManager = new ServiceDiscoveryManager(connection);

Original comment by sheraz.khilji@maavratech.com on 24 Apr 2012 at 2:04