[英]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 call method getMessageCount in the first line of code that i貼在這里。
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;
我遇到了你描述的同樣的問題。
我得到了 ASmack 項目源代碼,並且正在生成自己的庫。
此特定問題的解決方法是調用
ServiceDiscoveryManager manager = new ServiceDiscoveryManager(connection);
登錄后。似乎他們錯過了在某些時候初始化這個 class。
如果您在此之后還有其他問題,請告訴我,我收到了 ClassCastException,但如果您遇到了,我可以為您提供幫助。
-f4
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.