当前位置: 首页>>代码示例>>Java>>正文


Java SmackAndroid.init方法代码示例

本文整理汇总了Java中org.jivesoftware.smack.SmackAndroid.init方法的典型用法代码示例。如果您正苦于以下问题:Java SmackAndroid.init方法的具体用法?Java SmackAndroid.init怎么用?Java SmackAndroid.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smack.SmackAndroid的用法示例。


在下文中一共展示了SmackAndroid.init方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import org.jivesoftware.smack.SmackAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    SmackAndroid.init(getApplicationContext());
    configure();

    // create the global wake lock
    PowerManager pwr = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pwr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Kontalk.TAG);
    mWakeLock.setReferenceCounted(false);

    mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
    mPushService = PushServiceManager.getInstance(this);

    // create idle handler
    HandlerThread thread = new HandlerThread("IdleThread", Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    mIdleHandler = new IdleConnectionHandler(this, thread.getLooper());
    mHandler = new Handler();
}
 
开发者ID:ShadiNachat,项目名称:Chatting-App-,代码行数:21,代码来源:MessageCenterService.java

示例2: ConnectionManager

import org.jivesoftware.smack.SmackAndroid; //导入方法依赖的package包/类
public ConnectionManager(Context context,
		ConnectionStatusCallback statusCallback,
		CommunicationManager communicationManager) {
	this.statusCallback = statusCallback;
	this.communicationManager = communicationManager;

	smack = SmackAndroid.init(context);

	SASLAuthentication.registerSASLMechanism(GTalkOAuthSASLMechanism.NAME,
			GTalkOAuthSASLMechanism.class);
	SASLAuthentication
			.supportSASLMechanism(GTalkOAuthSASLMechanism.NAME, 0);

	ConnectionConfiguration configuration = new ConnectionConfiguration(
			"talk.google.com", 5222, "gmail.com");
	configuration.setSASLAuthenticationEnabled(true);

	connection = new XMPPConnection(configuration);
}
 
开发者ID:nickglobal,项目名称:TvPoo,代码行数:20,代码来源:ConnectionManager.java

示例3: NumberValidator

import org.jivesoftware.smack.SmackAndroid; //导入方法依赖的package包/类
public NumberValidator(Context context, EndpointServer server, String name, String phone, PersonalKey key, String passphrase) {
    mContext = context.getApplicationContext();
    mServer = server;
    mName = name;
    mPhone = phone;
    mKey = key;
    mPassphrase = passphrase;

    mConnector = new XMPPConnectionHelper(mContext, mServer, true);
    mConnector.setRetryEnabled(false);

    SmackAndroid.init(context.getApplicationContext());
    configure();
}
 
开发者ID:ShadiNachat,项目名称:Chatting-App-,代码行数:15,代码来源:NumberValidator.java

示例4: onCreate

import org.jivesoftware.smack.SmackAndroid; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    SmackAndroid.init(this);
    ButterKnife.inject(this);
    init();

}
 
开发者ID:gongmingqm10,项目名称:SmackDemo,代码行数:10,代码来源:LoginActivity.java

示例5: logInToClient

import org.jivesoftware.smack.SmackAndroid; //导入方法依赖的package包/类
private void logInToClient() {
    Log.i(TAG, "logInToClient");

    if (hubCommandsClient != null) {
        Log.e(TAG, "Client is alerady connected");
        return;
    }

    ImageButton connectBtn = (ImageButton) findViewById(R.id.connectButton);
    connectBtn.setEnabled(false);

    /* TODO - remove comment if for some reason you see that the hub is not responsive and might need to authenticate with the myharmony web service
    String loginToken = auth.getLoginToken(Configuration.myHarmonyUser, Configuration.myHarmonyPassword);
    if (loginToken == null) {
        return;
    }
    */
    String loginToken = "testtesttesttest";

    //this needs to be called before XMPP is used in the app
    SmackAndroid.init(this);

    //if on home wifi then use the home wifi IP and port, otherwise use the external ones
    String hubIP = Configuration.hubWifiAddress;
    int xmppPort = Configuration.hubWifiXmppPort;
    WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    WifiInfo mWifi = wifiMgr.getConnectionInfo();
    String wifiName = mWifi.getSSID();
    if (wifiName == null || !wifiName.equals(Configuration.homeWifiSSID)) {
        hubIP = Configuration.hubInternetAddress;
        xmppPort = Configuration.hubInternetXmppPort;
    }

    hubCommandsClient = new Client(hubIP, xmppPort, this, this);
    //if (!auth.getSessionToken(loginToken, "192.168.2.128", hubCommandsClient)) {
    if (!auth.getSessionToken(loginToken, hubIP, xmppPort, hubCommandsClient)) {
        connectBtn.setEnabled(true);
    }
}
 
开发者ID:itaybia,项目名称:androidHarmony,代码行数:40,代码来源:MainActivity.java

示例6: XMPPCommunicator

import org.jivesoftware.smack.SmackAndroid; //导入方法依赖的package包/类
/**
* XMPPClass Constructor
* @param username : XMPP server username
* @param password : XMPP server password
* @param topicName : XMPP main topic name (RC topic name)
* @param Server : XMPP Server name
* @param appContext : The application context
*/
public XMPPCommunicator(String username, String password, String topicName, String Server, Context appContext){
	
	NodeListeners = new HashMap<String, ItemEventCoordinator>();
	Nodes = new HashMap<String, Node>();
	
	Username = username;
	Password = password;
	Topic = topicName;
	ctx = appContext;
	flag = true;
	
	serverName = Server;
	
	msgPub = new MessagePublisher("XMPP");
	
	//Init aSmack
	SmackAndroid.init(ctx);
	
	//Set the reply timeout of asmack in ms to avoid server not responding fast enough if busy
	//SmackConfiguration.setPacketReplyTimeout(10000);

	// XMPP CONNECTION		
	connConfig = new ConnectionConfiguration(serverName,PORT);
	
	//connConfig.setSASLAuthenticationEnabled(true);
	connConfig.setCompressionEnabled(true);
	connConfig.setSecurityMode(SecurityMode.disabled);
	/*
	//Connection configuration - generates a warning on startup because the truststore path is set to null
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
		connConfig.setKeystoreType("AndroidCAStore");
		//connConfig.setKeystorePassword(null);
		connConfig.setKeystorePath(null);
		//connConfig.set
	} else {
		connConfig.setKeystoreType("BKS");
	    String path = System.getProperty("javax.net.ssl.trustStore");
	    if (path == null)
	        path = System.getProperty("java.home") + File.separatorChar + "etc"
	            + File.separatorChar + "security" + File.separatorChar
	            + "cacerts.bks";
	    connConfig.setKeystorePath(path);
	}
	*/
	xmpp = new XMPPTCPConnection(connConfig);
	
}
 
开发者ID:NitLab,项目名称:Android_Resource_Controller,代码行数:56,代码来源:XMPPCommunicator.java


注:本文中的org.jivesoftware.smack.SmackAndroid.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。