asmack初步学习笔记

先贴一个Asmack的下载连接 http://asmack.freakempire.de/0.8.1.1/

SmackAndroid smackAndroid=SmackAndroid.init(Context);

这是一句平台初始化的语句必须先执行。

ConnectionConfiguration config =new ConnectionConfiguration("IP-Address");
config.setSecurityMode(SecurityMode.disabled);
connection = new XMPPConnection(config);

这是连接基础配置

由于连接服务器与登录需要连接网络,所以无法在 线程中操作,需要另开一个线程 。

connection.connect()

connection.login((String username,String password)

信息

需要获取  ChatManager ctm=connection.getChatManager();

消息处理:

public void sendmsg(String msg){
  if(isLoged){
    if(ct==null){
      ct=this.ctm.createChat("[email protected]", new MessageListener() {
        @Override
        public void processMessage(Chat mche, Message mmsg) {
          if(mmsg!=null&&mmsg.getBody()!=null){
             处理接收到的信息
         }
        }
      });     

      try {

        发送信息
        ct.sendMessage(msg);
      } catch (XMPPException e) {
        e.printStackTrace();
      }

    }

}

  

时间: 2024-10-11 01:23:46

asmack初步学习笔记的相关文章

A.Kaw矩阵代数初步学习笔记 6. Gaussian Elimination

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第6章课程讲义下载(PDF) Summary Gaussian elimination consists of two steps: Forward Elimination of Unknowns In this step, the unknown is elim

A.Kaw矩阵代数初步学习笔记 8. Gauss-Seidel Method

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第8章课程讲义下载(PDF) Summary Algorithm Given a general set of $n$ equations and $n$ unknowns $$\begin{cases}a_{11}x_1 + a_{12}x_2 +\cdots

A.Kaw矩阵代数初步学习笔记 7. LU Decomposition

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第7章课程讲义下载(PDF) Summary For a nonsingular matrix $[A]$ on which one can always write it as $$[A] = [L][U]$$ where $[L]$ is a lower tr

A.Kaw矩阵代数初步学习笔记 5. System of Equations

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第5章课程讲义下载(PDF) Summary Consistent and inconsistent system A system of equations $$[A][X]=[B]$$ where $[A]$ is called the coefficient

A.Kaw矩阵代数初步学习笔记 4. Unary Matrix Operations

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第4章课程讲义下载(PDF) Summary Transpose Let $[A]$ be a $m\times n$ matrix. Then $[B]$ is the transpose of $[A]$ if $b_{ji} = a_{ij}$ for al

A.Kaw矩阵代数初步学习笔记 3. Binary Matrix Operations

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第3章课程讲义下载(PDF) Summary Addition of matrices Two matrices $[A]$ and $[B]$ can be added only if they are the same size. The addition i

A.Kaw矩阵代数初步学习笔记:2. Vectors

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第2章课程讲义下载(PDF) Summary Vector A vector is a collection of numbers in a definite order. If it is a collection of $n$ numbers, it is c

A.Kaw矩阵代数初步学习笔记 9. Adequacy of Solutions

“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔记下载(Academia.edu) 第9章课程讲义下载(PDF) Summary Ill-conditional system A system of equations is considered to be ill-conditioned if a small change in the coe

Android属性动画初步学习笔记

近期学习Android属性动画和VetcorDrawable实现属性动画,以此记录一下学习笔记. 首先是属性动画,小白没截过动态图,方三张静态图吧       效果是点击红色图片,7个选项以属性动画的方式弹出并旋转,最后成一个1/4圆弧排列,再次点击则收回到红色原点下. 布局文件很简单,就是一个RelativeLayout下八个ImageView: 1 <?xml version="1.0" encoding="utf-8"?> 2 <Linear