Offline Message using smack in android
I can able to create small chat application using smack api.how ever ,i am unable to receive offline messages by using offlineMessageManager class in smack api.It just throws a nullpointerexception when i supposed to开发者_如何学Go call method getMessageCount in the first line of code that i pasted here.
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(null,namespace);
Form extendedInfo = Form.getFormFrom(info);
if (extendedInfo != null) {
String value = extendedInfo.getField("number_of_messages").getValues().next();
return Integer.parseInt(value);
}
}
return 0;
I got the same issue you described.
I got the ASmack project source, and I'm generating my own library.
The fix for this particular issue is to call
ServiceDiscoveryManager manager = new ServiceDiscoveryManager(connection);
after you logged in. Seems they missed to initialize this class at some point.
Let me know if you have other issues after this, I got a ClassCastException, but I can help you if you got it.
-f4
精彩评论