smack

Smack API User search

放肆的年华 提交于 2019-11-27 07:11:24
问题 I'm try to implement a user search on top of my working Smack-API based jabber client.It can create user using: AccountManager manager = conn.getAccountManager(); manager.createAccount(usename,password); However I need to add a functionality that will first search for "existing" user before it creates the account, but I can't find any straightforward way to do it. Anyone can provide me hints? Thanks. 回答1: Apparently what's needed is just to catch the error code 409 in the XMPPException, as

How to know Typing Status in XMPP openfire using Smack

☆樱花仙子☆ 提交于 2019-11-27 03:26:15
I am developing chat application by using Openfire XMPP server. I can text chat between two user. But i want to know Typing status when some one is typing message. So i created a class :- public class typingStatus implements ChatStateListener { @Override public void processMessage(Chat arg0, Message arg1) { // TODO Auto-generated method stub } @Override public void stateChanged(Chat arg0, ChatState arg1) { // TODO Auto-generated method stub System.out.println(arg0.getParticipant() + " is " + arg1.name()); } } But i am confuse so that How will it work? I know that i need a packet where i can it

XMPP aSmack - How can I get the current user state (offline/online/away/etc.)?

江枫思渺然 提交于 2019-11-27 01:21:42
问题 I am new to xmpp/asmack in android. Can anyone please help me in getting the presence of the user's friends ( roster list) I am using this : Presence availability = roster.getPresence(user); Mode userMode = availability.getMode(); What else should I do to get the availability status of each user listed in my roster. 回答1: Just use like this : Presence availability = roster.getPresence(user); Mode userMode = availability.getMode(); retrieveState_mode(availability.getMode(),availability

XMPP with Java Asmack library supporting X-FACEBOOK-PLATFORM

久未见 提交于 2019-11-27 00:52:23
I'm trying to make a Facebook Chat on Android with the Smack library. I've read the Chat API from Facebook, but I cannot understand how I have to authenticate with Facebook using this library. Can anyone point me how to accomplish this? Update : According to the no.good.at.coding answer, I have this code adapted to the Asmack library. All works fine except I receive as response to the login: not-authorized. Here is the code I use: public class SASLXFacebookPlatformMechanism extends SASLMechanism { private static final String NAME = "X-FACEBOOK-PLATFORM"; private String apiKey = ""; private

GCM XMPP Server using Smack 4.1.0

99封情书 提交于 2019-11-26 19:25:28
问题 I'm trying to adapt the example provided here for Smack 4.1.0. and getting a little confused. Specifically I'm struggling to understand what the GcmPacketExtension should now extend, how the constructor should work and how the Providermanager.addExtensionProvider should be updated to tie in with it. I'm sure someone must have done this before but I can't find any examples and I seem to be going round in circles using just the documentation. Any help would be much appreciated, I'm sure the

Mapping Openfire Custom plugin with aSmack Client

人盡茶涼 提交于 2019-11-26 18:39:33
问题 I'm a newbie to XMPP so forgive me if this question sounds silly. I want to create a custom plugin and map it with my aSmack client on Android. I'm trying to apply my knowledge of Web Services but I'm not winning. So please guide my thinking toward the best approach, an example will be really helpful. Thanx in advance. 回答1: There are many types of plugins, let's talk in general pourpose. Igniterealtime Plugin guide You want to define a brand new IQ Stanza to manage an UserCustomParam. Let's

ConnectionException when trying to connect to XMPP server from aSmack Android client

孤者浪人 提交于 2019-11-26 18:36:45
问题 I have been trying to connect to my (locally hosted) Openfire XMPP server from my aSmack Android client for hours now, and it's still not working. I get a org.jivesoftware.smack.SmackException$ConnectionException and that's it. Code: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SmackAndroid.init(getApplicationContext()); connect(); } private boolean

Authenticate to Google Talk (XMPP, Smack) using an authToken

戏子无情 提交于 2019-11-26 16:38:39
问题 The app I'm writing is connecting to a XMPP server, and if the user chooses, I want to give them the option to connect to their google chat account, without having to enter the credentials... To do this, I'd get the permission to use the google account, get the token and authenticate to google talk (XMPP server, using Smack) using the token.. The problem is.. how do I do that? I mean, how do I authenticate to the GTalk server if I know the login and the token? Any ideas, insights? :) If not,

How to keep a XMPP connection stable on Android with (a)smack?

走远了吗. 提交于 2019-11-26 15:48:18
问题 I use asmack-android-7-beem library for Android. I have a background service running, such as my app stays alive. But sooner or later XMPP connection dies without any notice. The server says that the client is still online but no packets are sent or received. For example the client doesn't receive any presence packets when other clients have a new presence. I have XMPPConnection as an attibute of my main Application class. I set ConnectionConfiguration config.setReconnectionAllowed(true)

getSearchForm returns null when using UserSearch in XMPP with aSmack

怎甘沉沦 提交于 2019-11-26 14:20:09
问题 I have this code, almost unmodified from examples: UserSearchManager usm = new UserSearchManager(conn); Form searchForm = usm.getSearchForm("search.myserver.com"); Form answerForm = searchForm.createAnswerForm(); answerForm.setAnswer("Username", true); answerForm.setAnswer("search", contact.getJid()); ReportedData data = usm.getSearchResults(answerForm, "search.myserver.com"); This works perfectly in a Desktop environment, using Smack library, but I can't get it to work in Android (where I