Show chat logs history with asmack android - android

Recently, I try to build a chat app in android with XMPP! I installed Ejabberd, and with connection, I can chat with another user with my android app! But now, I have an issue in retrieve chat logs history! I mean that I don't know how to get chat history with Asmack and Ejabberd. I tried reading the smack document, however, I can find nothing!! So, anyone has any suggestion to get chat history with asmack and Ejabberd? Thank very much!

Ejabberd does not necessarily save chat history by default, since that can be a potentially very expensive task. Nor is it built into the core part of the server. There are modules available such as mod_archive that can installed/enabled that would allow you to save some chat history, but as chat history is not part of the core XMPP spec, there is no "standard" way to do it, so it would only work when connecting to your own servers. What you might consider doing instead is archiving your chat history yourself locally. You will notice that this is what most desktop XMPP clients do. Enabling mod_offline would allow you to receive message that were sent to you when you were offline. But there is no special method for retrieving them, they just arrive when you log in.

Related

Trying to setup device-to-device notifications via FCM; any recommendation when it comes to FCM and choosing XMPP server?

I read the documentation for FCM in Firebase website, looked into answers here for related questions and googled. All good, but as a newbie I am not sure what's best approach when it comes in choosing the XMPP server.
Is there anything that would limit one of the servers in the list blow when it comes to connecting to FCM? I have a list of servers here.
Should I choose one of the servers in this list for FCM if I need device to device notifications or is there any other choice. I need it for when a new message arrives in a chat app or similar cases when a ChildAdded or modified and the app is backgrounded or closed?
I cannot find any info on the XMPP servers and if Firebase has any recommendation. I would need all three iOS, Android, and Web app support.

how to retrieve the chat history from openfire server?

I have created a chat application using openfire server and used Smack Api.Its all working fine,now i need to retreive the chat history from openfire server.
I have installed Monitoring Plugin to archive the chat.
In above screenshot, I can able to see the chat history for both one to one chat and group chat.
Now i need to get the chat history through app programmatically.I have referred many articles and post but did not find a solution.
If anyone know please tell your suggestions.
Thanks in advance.
Possible duplicate question.
If you have installed the monitoring plugin, you can read in its readme file under the configuration paragraph the following content:
Chat archiving is enabled by default. However, only information about who is communicating and at what time is stored unless chat transcript archiving is enabled. To enable chat transcript archiving or group chat archiving, you will need to log into the admin console and go to:
Server --> Archiving --> Archiving Settings
Thereafter the messages get stored in your external database table 'ofMessageArchive'.
This history can be further fetched from the database.
the XEP (XMPP Extension Protocol) that discuss about this is the XEP-0313.
There are some open issues in Openfire backlog to acomplish this XEP.
So, I suppose that ins't possible yet :(
Good luck!

How to get chat history from openfier server using asmack?

I'm developing simple chat application, in which I have done chat functionality, means my app user can send and receive chat messages at both end.
But now I want to get chat history of same user, how can I do that? I have tried various things and also done lots of R & D but I don't get required information.
I'm using asamck lib, and openfire server. I added monitoring service plugins on my server, but what is next step to get the history?

XMPP (Openfire) Push Notifications Android

I really tried to find a solution to this problem but didn't. There are some threads related to this concept, but I didn't find a comprehensive solution.
I have a server with Openfire which sends messages. When both users are online, there is no problem. However, when a user is offline I would like to send a push notification, as in Whatsapp. I heard that Whatsapp and other IM apps use a modified version of ejabber to send push notifications, but couldn't find out how.
One possibility is to use GCM, but I am not sure if this is the right way to go. Also I would like to avoid polling, for the sake of not draining battery life.
Does anyone know some solution to this or has an example?
I am studying the openfire and found some good options that I would like to share with you.
I found a plugin in github and i will test it this week. It seems that will be a good solution to your goal and to my: https://github.com/meisterfuu/Openfire-GCM/
Another option is to use CallbackOnOffline Plugin that calls a specified URL with To and From parameters. This url could be a endpoint in your web service, and with that data (To and From) you could get the associated Id for push in your base, and did a push.
https://www.igniterealtime.org/projects/openfire/plugins.jsp
Well, you could use GCM with XMPP.
The new GCM Cloud Connection Server allows you to use the XMPP protocol for a bidirectional (Cloud to Device and Device to Cloud) communication between your server and your Android application.
The GCM Cloud Connection Server (CCS) allows third party servers to
communicate with Android devices by establishing a persistent TCP
connection with Google servers using the XMPP protocol. This
communication is asynchronous and bidirectional.
In openfire its done automatically, messages will be recieved by the user when the user gets online. So no worries send message to an offline user and when the user comes online message will automatically pushed to the user.

Recent chats xmpp android application

I am android developer. I am working on a Android application creating a Chat application. I am facing a small issue in displaying the recent chats using XMPP service. How can i fetch the recent chats. Is there any inbuilt function that i can use to fetch the data in XMPP. I am newly working on XMPP concepts. Any ideas will be of great help to me.
Thanks
depending on your XMPP server, you might not be able to get the recent chats (because the server might not store them for too long).
You would be better off saving all the chats to an internal SQLite database, and retrieving them from there as you need them. A classic XMPP server is only guaranteed to keep messages that have not been delivered yet.

Categories

Resources