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


Java Sinch类代码示例

本文整理汇总了Java中com.sinch.android.rtc.Sinch的典型用法代码示例。如果您正苦于以下问题:Java Sinch类的具体用法?Java Sinch怎么用?Java Sinch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initiateSinchClient

import com.sinch.android.rtc.Sinch; //导入依赖的package包/类
/**
 * Build sinch client for audio and video calling by providing all keys and user id etc.
 * @param context activity context for sinch client
 * @param configurationData all required keys in JSONObject
 */
public static JSONObject initiateSinchClient(Context context, JSONObject configurationData)
{
    JSONObject returnStatus = new JSONObject();

    boolean state = false;
    
    try {
         sinchClient = Sinch.getSinchClientBuilder().context(context)
                .applicationKey(configurationData.getString(Constant.APPLICATION_KEY))
                .applicationSecret(configurationData.getString(Constant.APPLICATION_SECRET))
                .environmentHost(configurationData.getString(Constant.ENVIRONMENT_HOST))
                .userId(configurationData.getString(Constant.USER_ID))
                .build();
                
        state = true;

        returnStatus.put("status", state);
        returnStatus.put("sinch_initiation_state","Sinch initialization successfull");
    } catch (JSONException e) {
        e.printStackTrace();
    }
    
    return returnStatus;
}
 
开发者ID:parita-detroja,项目名称:cordova-plugin-sinch-calling,代码行数:30,代码来源:ConfigureSinch.java

示例2: startSinchClient

import com.sinch.android.rtc.Sinch; //导入依赖的package包/类
public void startSinchClient(String username) {
    sinchClient = Sinch.getSinchClientBuilder()
                       .context(this)
                       .userId(username)
                       .applicationKey(APP_KEY)
                       .applicationSecret(APP_SECRET)
                       .environmentHost(ENVIRONMENT)
                       .build();
    //this client listener requires that you define
    //a few methods below
    sinchClient.addSinchClientListener(this);
    //messaging is "turned-on", but calling is not     
    sinchClient.setSupportMessaging(true);
    sinchClient.setSupportActiveConnectionInBackground(true);
    sinchClient.checkManifest();
    sinchClient.start();
}
 
开发者ID:dmeyer3691,项目名称:PetTinder,代码行数:18,代码来源:MessageService.java

示例3: onCreate

import com.sinch.android.rtc.Sinch; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    String username = getIntent().getStringExtra("username");
    pubnub = new Pubnub("pub", "sub");
    pubnub.setUUID(username);

    sinchClient = Sinch.getSinchClientBuilder()
        .context(this)
        .userId(username)
        .applicationKey("key")
        .applicationSecret("secret")
        .environmentHost("sandbox.sinch.com")
        .build();

    sinchClient.setSupportCalling(true);
    sinchClient.startListeningOnActiveConnection();
    sinchClient.start();
    sinchClient.getCallClient().addCallClientListener(new SinchCallClientListener());

    pickupButton = (Button) findViewById(R.id.pickupButton);
    hangupButton = (Button) findViewById(R.id.hangupButton);
}
 
开发者ID:sinch,项目名称:presence-calling-android,代码行数:26,代码来源:MainActivity.java

示例4: startSinchClient

import com.sinch.android.rtc.Sinch; //导入依赖的package包/类
public void startSinchClient(String username) {
    sinchClient = Sinch.getSinchClientBuilder().context(this).userId(username).applicationKey(APP_KEY)
            .applicationSecret(APP_SECRET).environmentHost(ENVIRONMENT).build();

    sinchClient.addSinchClientListener(this);

    sinchClient.setSupportMessaging(true);
    sinchClient.setSupportActiveConnectionInBackground(true);

    sinchClient.checkManifest();
    sinchClient.start();
}
 
开发者ID:Paulocajr,项目名称:IPRJapp,代码行数:13,代码来源:MessageService.java

示例5: onCreate

import com.sinch.android.rtc.Sinch; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_call);

    final SinchClient sinchClient = Sinch.getSinchClientBuilder()
        .context(this)
        .userId("current-user-id")
        .applicationKey("key")
        .applicationSecret("secret")
        .environmentHost("sandbox.sinch.com")
        .build();

    sinchClient.setSupportCalling(true);
    sinchClient.start();

    callState = (TextView) findViewById(R.id.callState);
    callButton = (Button) findViewById(R.id.callButton);

    callButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (call == null) {
                call = sinchClient.getCallClient().callPhoneNumber("+46000000000");
                call.addCallListener(new SinchCallListener());
                callButton.setText("Hang Up");
            } else {
                call.hangup();
            }
        }
    });
}
 
开发者ID:sinch,项目名称:android-pstn-tutorial,代码行数:33,代码来源:CallActivity.java

示例6: onCreate

import com.sinch.android.rtc.Sinch; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.call);

    Intent intent = getIntent();
    callerId = intent.getStringExtra("callerId");
    recipientId = intent.getStringExtra("recipientId");

    sinchClient = Sinch.getSinchClientBuilder()
        .context(this)
        .userId(callerId)
        .applicationKey("key")
        .applicationSecret("secret")
        .environmentHost("sandbox.sinch.com")
        .build();

    sinchClient.setSupportCalling(true);
    sinchClient.startListeningOnActiveConnection();
    sinchClient.start();

    sinchClient.getCallClient().addCallClientListener(new SinchCallClientListener());

    button = (Button) findViewById(R.id.button);
    callState = (TextView) findViewById(R.id.callState);

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (call == null) {
                call = sinchClient.getCallClient().callUser(recipientId);
                call.addCallListener(new SinchCallListener());
                button.setText("Hang Up");
            } else {
                call.hangup();
            }
        }
    });
}
 
开发者ID:sinch,项目名称:app-app-calling-android,代码行数:40,代码来源:CallActivity.java


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