Alex Rumba Nicked Alex Rumba Nicked - 1 year ago 171
AngularJS Question

WebRTC video call and IONIC, call when app runs in background

I made an application using twilio, webRTC and ionic, and the video call is working. However, is it possible to make the video call when the app runs in background? I couldn't come up with a solution with ionic.

Answer Source

I created a landing page upon login which has all the token grant and initialization of twilio so that once a user logs in. It is already on listening mode. Then, i handled the opening of push to actually just redirect to that particular landing page. In my case, the landing page is app.onlineUsers

         var notificationOpenedCallback = function(jsonData) {
        console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData.action));
        if (jsonData.action) {
            if (jsonData.action.actionID == "IdAccept") {
                //custom code executes
            } else if (jsonData.action.actionID == "IdReject") {
    window.plugins.OneSignal.getIds(function(ids) {
        // alert(ids);
        did = ids.userId;
        $sessionStorage.DID = did;
        $localStorage.DID = did;
        // alert(" player_id: "+$localStorage.DID);
    // TODO: Update with your OneSignal AppId and googleProjectNumber before running.
    window.plugins.OneSignal.startInit("appId", "googleProjectNumber")
 .handleNotificationOpened(notificationOpenedCallback).handleNotificationReceived(function(jsonData) {
            // alert("Notification received:\n" + JSON.stringify(jsonData));
            // console.log('Did I receive a notification: ' + JSON.stringify(jsonData));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download