loadChats give null
trying to get chat count and unread messages, I query loadChats() ['query', {type: 'chat', epoch: '4'}, null] response is ["response", {"duplicate":"true","type":"chat","status":"17931"}, null]
other requests works fine. any help, please?
Same here. Tried loadChats() and got null.
sendMessage() works perfect!
same problem here, any workaround/fix available?
Hey, I'm sorry, but due to time constraints I'm only managing this project very infrequently.
As far as I know, the fact that WhatsApp replies with a duplicate message means that an identical message has previously been sent. Therefore it is cached in the WAMessageParser class and returned when client.loadChats() is called.
This does not work for all of you?
nope, at connection whatsapp send many message at client but not in chat format, and storedWAChats remains null. there are difference based on android/iphone whatsapp main installation: on android after negotiation may have chats, on iphone never....!
on iphone also load contacts is working only after a connection that require a qrcode. if i do reconnect, no contacts are given.
I suggest you to debug by modify your class backendConnector.waitForTextMessage just for test and see whitch messages came from whatsapp: (but sometimes may occur concurrent modification exeption) now for each message received I try to parse with WAMessageParser.jsonToObjects(message); very slower, but now i can have chats!
boolean waiting = false; /** * Waits until a message matching a specified string has been received from the * onTextMessage or onBinaryMessage callback and returns it * * @param search * @return / private String waitForTextMessage(String... search) { while(waiting) { Utils.waitMill(200); } textMessageBuffer.clear(); String foundMessage = null; String lastMessage = null; if(search.length > 0) { waiting = true; for(int i = 0; i < 200; i++) { for(String s : search) { for(String message : textMessageBuffer) { System.out.println("\t* waitForTextMessage("+s+") *************** "+i+"\n"+message); try { WAMessageParser.jsonToObjects(message); } catch (Exception e) { } if(message.contains(s)) { foundMessage = message; // return message; } if(foundMessage != null && foundMessage.equals(lastMessage)) { i = 300; break; } lastMessage = message; } } Utils.waitMill(100); } } waiting = false; return foundMessage; // return null; }
here is an example of my response: ## sendText() ## ['query', {type: 'chat', epoch: '3'}, null] ** waitForTextMessage("type":"chat") *************** 2 793.--3, ** waitForTextMessage("type":"chat") *************** 3 793.--3, ** waitForTextMessage("type":"chat") *************** 4 793.--3, ** waitForTextMessage("type":"chat") *************** 5 ...... omiss..... ["response", {"checksum":"B32939D8-421F-4743-BDBF-ABF8F70FA555","type":"contacts"}, [["user", {"jid":"[email protected]","name":"Gary xxx","short":"Gary","index":"G"}, null], ["user", ...... omiss..... , null]]] ** waitForTextMessage("type":"chat") *************** 17 ["response", {"duplicate":"true","type":"chat","status":"299750"}, null]