Skip to content
NativeScript plugin for Sinch , Use the Sinch APIs to enhance your app with Voice, SMS, Verification, Video, and Instant Messaging
TypeScript JavaScript Java CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo
helpers
platforms/android/data
.gitignore
.npmignore
LICENSE
README.md
install.ts
package.json
sinch.android.ts
sinch.common.ts
sinch.ios.ts
tsconfig.json
uninstall.ts

README.md

npm npm #NativeScript-Sinch ##WIP

##Install Note : If the android platform is not added before installing this plugin the installation will fail.

tns platform add android 
tns plugin add nativescript-sinch
var sinch = require('nativescript-sinch');

//or

import {Sinch} from 'nativescript-sinch';

Initialize

var sinchClient = new sinch.Sinch("appKey", "appSecret", "host", "username");

//or

let sinchClient  = new Sinch("appKey", "appSecret", "host", "username");

Specify the client capabilities

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

Start the client

sinchClient.start();

Stop listening for incoming events (calls or messages).

sinchClient.stopListeningOnActiveConnection();

Stop the client when the calling or messaging functionality is no longer needed.

sinchClient.stop();

Get CallClient

sinchClient.getCallClient();

e.g

var callClient = sinchClient.getCallClient();
callClient.callUser("triniwiz");

Methods

addCallClientListener(callClientListener:()=>void)
callConference(conferenceId:string)
callConference(conferenceId,headers:string[])
callPhoneNumber(phoneNumber:string)
callPhoneNumber(phoneNumber:string,headers:string[])
callSip(sipIdentity:string)
callSip(sipIdentity:string,headers:string[])
callUser(toUserId:string)
callUser(toUserId:string,headers:string[])
callUserVideo(toUserId:string)
callUserVideo(toUserId:string,headers:string[])
getCall(callId:string)
removeCallClientListener(callClientListener:()=>void)
setRespectNativeCalls(respectNativeCalls:boolean)

Get MessageClient

sinchClient.getMessageClient();

e.g

var messageClient = sinchClient.getCallClient();

Methods

var message = sinchClient.writableMessage();
var message = sinchClient.writableMessage(["triniwiz","brad","jen","peter"],"Hi");
var message = sinchClient.writableMessage("triniwiz","Sup");
messageClient.send(message);
addMessageClientListener(callback:()=>void);
removeMessageClientListener(callback:()=>void);
send(message:WriteableMessage);

Get VideoController

 sinchClient.getVideoController()
  

e.g

var videoController = sinchClient.getVideoController();
videoController.getCaptureDevicePosition() 
videoController.getLocalView() 
videoController.getRemoteView() 
videoController.setBorderColor(float r, float g, float b)
videoController.setCaptureDevicePosition(int facing)
videoController.setResizeBehaviour(VideoScalingType type)
videoController.toggleCaptureDevicePosition() 

Get AudioController

  sinchClient.getAudioController()

e.g

var audioController = sinchClient.getAudioController();

audioController.mute();
audioController.unmute();
audioController.enableSpeaker();
audioController.disableSpeaker();
You can’t perform that action at this time.