<

Get started with Android SDK

The Plivo Android SDK lets you integrate voice into your Android apps.

Step 1: Register an endpoint

1
2
3
4
5
public final static String ENDPOINT_USERNAME = "Tatooine";
public final static String ENDPOINT_PASSWORD = "Jabba";
Endpoint endpoint = Endpoint.newInstance(true, this);
endpoint.setRegTimeout(600);//Number in seconds
endpoint.login(ENDPOINT_USERNAME, ENDPOINT_PASSWORD);

Step 2: Making a call

1
2
3
public final static String PHONE_NUMBER = "1415XXXXXXX";
outgoing = endpoint.createOutgoingCall();
outgoing.call(PHONE_NUMBER);

Step 3: Receive a call

Implement EventListener on your class and override the onIncomingCall method.

1
2
3
public void onIncomingCall(Incoming incoming) {
    incoming.answer();
}

Step 4: Auto connect when network is available

Set NetworkChangeReceiver, in the onCreate() method of your class, to auto connect when the network is available.

1
2
3
4
networkReceiver = new NetworkChangeReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
this.registerReceiver(networkReceiver, intentFilter);