I am working on sinch app to app call API, have integrated incoming and outgoing call screen.
My issue is, if call is ongoing and user removes application from backgroud, what will happen?
to overcome this issue, i have written call.hangup()
in onDestroy()
of activity, but it's neither hangingup sinch call nor giving any error.
@Override
protected void onDestroy() {
super.onDestroy();
call.hangup();
}
I have tried by putting super.onDestroy()
after call.hangup()
but that also didn't work.
Here is service class from where i am maintaining SinchClient :
public class SinchService extends Service
{
public static SinchClient sinchClient;
@Override
public void onCreate() {
super.onCreate();
connect();
}
private void connect() {
sinchClient = Sinch.getSinchClientBuilder().context(this)
.applicationKey(getResources().getString(R.string.sinch_app_key))
.applicationSecret(getResources().getString(R.string.sinch_app_secret))
.environmentHost(getResources().getString(R.string.sinch_app_host))
.userId(SharedPreferenceUtil.getString("user_id", ""))
.build();
sinchClient.setSupportMessaging(true);
sinchClient.setSupportCalling(true);
sinchClient.setSupportActiveConnectionInBackground(true);
sinchClient.startListeningOnActiveConnection();
sinchClient.addSinchClientListener(this);
sinchClient.start();
}
}