2015-06-22 148 views
-9

想要使用Liblinphone库为Android开发SIP客户端。 有一个接受认证的LinphoneAuthInfo类。 和LinphoneCore.addAuthInfo()将核心信息添加到核心。如何使用Liblinphone接口类创建SIP连接?

问题是我无法初始化LinphoneAuthInfo和LinphoneCore类,因为它们是接口类,我不知道如何使用主题。

如果他们没有接口的类的我会做到这一点:

// Create Authentication object 
LinphoneAuthInfo authInfos; 
authInfos.setDomain(id); 
authInfos.setUserId(username); 
authInfos.setPassword(password); 

// Config Core 
LinphoneCore linCore; 
linCore.addAuthInfo(authInfos); 

而且finaly,这是Liblinphone参考页:

http://www.linphone.org/docs/liblinphone-javadoc/org/linphone/core/LinphoneCore.html http://www.linphone.org/docs/liblinphone-javadoc/org/linphone/core/LinphoneAuthInfo.html

+4

如果你不知道如何“使用”界面,你真的不能开发Android应用程序尚未... –

+0

谢谢我的朋友。我知道一个接口是类的外壳。他们没有方法实现。这是正确的吗?那么这个方法的实现在哪里?你有任何参考或示例代码? – rostamiani

+2

你有没有试过谷歌“java界面教程”? –

回答

0

绝对的接口不能被初始化。因为它没有方法实现。这不是一堂课!

我应该使用实现这些方法的类。

其实我应该使用org.linphone.core(库),而不是LinphoneCore(Intreface)

0

我我在java网站上发现了这个。这是使用接口道:

public interface OperateCar { 
    // constant declarations, if any 
    // method signatures 

    // An enum with values RIGHT, LEFT 
    int turn(Direction direction, 
      double radius, 
      double startSpeed, 
      double endSpeed); 
    int changeLanes(Direction direction, 
        double startSpeed, 
        double endSpeed); 
    int signalTurn(Direction direction, 
        boolean signalOn); 
    int getRadarFront(double distanceToCar, 
        double speedOfCar); 
    int getRadarRear(double distanceToCar, 
        double speedOfCar); 
     ...... 
    // more method signatures 
} 


public class OperateBMW760i implements OperateCar { 

    // the OperateCar method signatures, with implementation -- 
    // for example: 
    int signalTurn(Direction direction, boolean signalOn) { 
     // code to turn BMW's LEFT turn indicator lights on 
     // code to turn BMW's LEFT turn indicator lights off 
     // code to turn BMW's RIGHT turn indicator lights on 
     // code to turn BMW's RIGHT turn indicator lights off 
    } 

    // other members, as needed -- for example, helper classes not 
    // visible to clients of the interface 
} 

更多信息可以在这里找到: https://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html

我希望这有助于

+0

这个网站真的不是语言教程的地方 –

+1

@sharonbn这只是一个问题的问题,我只是想帮助 –

+3

有时候最好的帮助是指出这个人在这个论坛以外的正确方向 –