• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Sinch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ArtifactResponse类代码示例发布时间:2022-05-22
下一篇:
Java XAttrFeatureProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap