B4A Library XMPP/JABBER - Best protocol to IM for B4A

XmppTop.png

XMPP/JABBER - Best protocol to Instant Messengers for B4A

This library was made based on XMPP Protocol

Installation instructions:
- Copy the .xml and .jar(s) files to your custom libraries folder
- Select in your REFERENCED LIBRARIES

ReferenceXMPP.jpg



Version history:
V1.0.0 (First public release - Donationware):
- Initial version

V1.0.1:
- Fix bug username

V1.0.2:
- Create 4 for events (ErrorSendMessage,ErrorConnect,ErrorLogin,PresenceChanged)
-
Create Methods: ChangeStatus, ActivatePresence
- Implemented correction in case the Name is Null

*Obs: PresenceChanged depends of each server.
Was observed in tests that some servers do not support the "presence listener"


V1.0.3:
- Fix bug when use XMPP and MQTT together

V1.0.4:
- Fix bug when use XMPP in some cases with threads

XMPP
Author:
Alberto Iglesias - alberto@visualnet.inf.br
Version: 1.0.4
  • XMPP
    Events:
    • deliverycomplete (Message As String)
    • messageArrived (Message As String)
    • onConnect ()
    • onDisconnect ()
    • onDisconnect (Status as boolean As )
    • onInitialized ()
    • onLogin ()
    • ErrorSendMessage(Error As String)
    • ErrorConnect(Error As String)
    • ErrorLogin(Error As String)
    • PresenceChanged(Presence As String)
    Fields:
    • Host As String
      Name or IP of the Jabber/XMPP Server
    • JavaDebug As Boolean
      Enable/Disable Debug from Java Code
    • Port As Int
      Port of the Jabber/XMPP Server
    Methods:
    • About As String
      About the developer
    • Connect
      Connect to the Jabber/XMPP Server
    • ChangeStatus(int iStatus)
      Change the status of your client
    • CreateChat (userJID As String)
      Create Chat with the JIB User
    • Disconnect
      Disconnect from Jabber/XMPP Server
    • GetHost As String
      Returns the host name of the server where the XMPP server is running
    • GetRoster As List
      Get Roster List
    • GetUser As String
      Get the connection current user
    • Initialize (eventname As String)
      Initializing XMPP Object
    • IsConnected As Boolean
      Get a connection status
    • IsSecureConnection As Boolean
      Check if the connection is secure
    • Login (Username As String, Password As String)
      Login into to the Jabber/XMPP Server
    • SendMessage (message As String)
      Send a message into the chat
    • Version As String
      Get the Library Version
    Permissions:
    • android.permission.ACCESS_WIFI_STATE
    • android.permission.INTERNET

ScreenXMPP.jpg


Xmpp1.jpg


Xmpp2.png


You can try your APP using web client in https://jwchat.org/


References:
http://xmpp.org/
https://jwchat.org/

* This version is fully functional, the only one difference is when sending a message the text "Donationware" is delivery with your message.
Please consider a simple €10 donation and I send to you the Library without "Donationware" text in a sendmessage method.





Version 1.0.4

Look others libraries in http://www.visualnet.inf.br/store


* Put in this link because this forum accept only 512k maximum.
 

Attachments

  • Example1.zip
    12.8 KB · Views: 599
  • Example3.zip
    13 KB · Views: 538
Last edited:

nw11

Member
Licensed User
Longtime User
Hi nw11,

Yes, I will looking for the sample in objective-c to convert into B4i Library.


thank you very much, let me know when there are news about the library for ios .. I will be happy to contribute financially to your project.
 

Alban

Member
Licensed User
Longtime User
Hi Alberto,
I just sent you the 10EUR donation, I like your lib a lot so far :) I just briefly tested and basic connection, getting roster, message sending works fine (tested with jwchat.org).
A list of things I didn't see yet but would love to have:
  • account creation from the app (but you seem to say it depends on the server?)
  • getting presence info for contacts in the roster
  • sending binaries (mainly photos, smileys, stickers and such)
  • search contacts in the server's directory
I used to work with Gloox, which is a C++ lib, but I don't know Smack that much.
 

juventino883

Member
Licensed User
Longtime User
Hi Alberto, I try your xmpp lib but when I try to log in, I get a NetworkOnMainThreadException, I add this persmissions to the manifest

AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_WIFI_STATE)

but I get the same result, I try it in android 4.0 and 4.4.2 , is a bug?, can you help me?, thanks in advance
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Alberto. I will try your library ( i need one chat in my app, of course if will work i send donation ) but...
jwchat.org now have "Registrations Closed" :confused: another alternative ??
Thanks
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Alberto
I just sent you the 10EUR donation.
Is very good library but if you add the suggestions sent by @Alban will be fantastic library

  • account creation from the app (but you seem to say it depends on the server?)
  • getting presence info for contacts in the roster
  • sending binaries (mainly photos, smileys, stickers and such)
  • search contacts in the server's directory

Ok i wait that you send me Library.
Thank you for your work
Bye
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Alberto. I tried using different Server ( example: xmpp.cm, chatme.im ) but i cant connect with any.
Look this movie:


Any suggestion ?
Thank you
Marco
 

Reids

Member
Licensed User
Longtime User
Is it possible to add fetch offline message on server?
xabber has feature which if receiver message isoffline, it can call certain command to retrieve last message,
but when target online, last sended message is fetched something like this http://xmpp.org/extensions/xep-0013.html
 

pappicio

Active Member
Licensed User
Longtime User
Hi all', I'm tring the lib, and I don't know if works on online server, but with my own openfire server it didn't, what wrong? It half/works, the only things I Can is login/logout from my device, but sensi or receive messages, It doesn't.
 
Last edited:

Christian García S.

Active Member
Licensed User
Hello Alberto, very interesting the library, I have a project just for this, but I would like to know if you can also implement it for IOS?

Thank you
 

birnesoft

Active Member
Licensed User
Longtime User
Hello Alberto,

is it possible to recieve a message from any other, when I'm only logged in the Server?
I tried to communicate with an other chat program (pidgin). It recieved my message and all that was offline sended without createChat.
But with your Samples it's only possible to chat when both sites has open the Chat.
Is there any way to recieve a message without createChat?

best regards Björn
 
Top