How to get Openfire chat history on Android device with aSmack?
Asked Answered
L

3

10

I am developing a chatting application, where user will chats with one of the domain expert's group member. user uses my android app and domain expert uses spark web for chatting. I made Openfire setup and Spark web setup and developed Android chatting app with aSmack library. My app users are able to chat with domain expert. So far it is fine. Now I would like show chat history of user with any or specific expert on Android device. After surfing web, I am able to install Monitoring Service plugin for my open fire server, which is showing chat history of user on Admin side as shown below.enter image description here

Now I would like to show this history in my Android app, How can I achieve this. Any suggestions, most welcome. Am I moving in the right direction? or there any simple ways to do my job? Any info on where this chat history will be stored in Open fire Database, so that I can make SQL queries and get data using webservices is most appreciated.

Lette answered 27/1, 2013 at 6:33 Comment(0)
S
4

You can get groupchat history by using following code:

DiscussionHistory history = new DiscussionHistory();
history.setMaxStanzas(0);


multiUserChat.join("username", "password", history, SmackConfiguration.getPacketReplyTimeout());
Steepen answered 12/5, 2015 at 7:5 Comment(5)
I am able to get group chat history using this..but can anyone tell me how to get one to one chat history?Steepen
i have used the above code to cod in the group,and now how do i get the chat history in my application.Bullyboy
It means we do not get the history from the Xmpp smack.As i notice in IOS , they are easily getting the one to one chatting history. If there any way to get the XMPP chatting history.Please let me know.. ThanksCavan
@RavindraKushwaha we have maintain a local database for history unlike ios.Steepen
@Bullyboy when u connect to the group ,automatically messages will be received in the listener.Steepen
G
2

If you are using MUC (XEP-45) then you can request the discussion history when entering a MUC. See XEP-45 7.2.14 Discussion History. When using (a)Smack, this mean that you have to use MultiUserChat.join(String nickname, String password, DiscussionHistory history, long timeout) to get the History.

Guillerminaguillermo answered 27/1, 2013 at 12:17 Comment(5)
I don't want user to join in any chat rooms to get history. I want history of user when he is offline. I want chat history of user with another user not with group.Lette
Hi @vrs i was also looking for the same requirement. Are you able to find any code snippet or a sample ??Rodrigorodrigue
No simple way found. As mentioned only from data base I am able to get that info.Lette
If i want to retrieve one to one chat history than what i do. I search on internet but i am not getting proper ansOpiumism
@Guillerminaguillermo Please check out my question for retrieving chat history #27126213Opiumism
L
2

I added Monitoring service Plugin to openfire, which created some additional tables to store chat conversation details between any 2 accounts. Monitoring service also gives you data base query statics. From admin panel data base statics, I am able to get in which tables, which columns this chat details got stored. Also required queries. using the above info, My back end team has written web services to get required info. This is the way I implemented.

Lette answered 25/8, 2013 at 6:12 Comment(4)
Can you Please share in which tables the messages were savedPaperboy
@vrs , me too facing the same problem,i added the Monitoring plugin,where the additional table will be create .. can you please elaborate your answer.Bullyboy
Sorry, I forgot. Don't have that project setup now.Lette
It means we do not get the history from the Xmpp smack.As i notice in IOS , they are easily getting the one to one chatting history. If there any way to get the XMPP chatting history.Please let me know.. ThanksCavan

© 2022 - 2024 — McMap. All rights reserved.