2

I am using sinch for VOIP calls. I need to know how to detect incoming calls when my app is offline or the process is killed. It can be done through background service but cannot understand how to build such service and which method can be used.

Akshay Mahale
  • 63
  • 1
  • 7

2 Answers2

0

You can check the device status whether it is active or inactive

 - (void)client:(id<SINCallClientDelegate>)client didReceiveIncomingCall:(id<SINCall>)call {
    if (call.details.applicationStateWhenReceived == UIApplicationStateActive) {

 //perform segue 
    }
}
Nesh
  • 134
  • 9
0

Basically when the app is offline, Sinch sends a push message that should be intercepted in GcmBroadcastReceiver and then you call GcmIntentService which initializes Sinch and connects you to the call. Of course you need to setSupportManagedPush(true) and setSupportPushNotifications(true) when initializing your SinchClient.

There's a sample project provided by Sinch to help you with all this. Just go to Sinch website and download the ANDROID SDK 3.9.3 ZIP file. It has a samples folder that contains 5 projects.

Check the project sinch-rtc-sample-push, it has the GCM implementation along with a SinchService. You can use the same classes in your project.

kristoffz
  • 129
  • 1
  • 8