Skip to content

Not able to make network calls while device is locked #25

@HugoHeneault

Description

@HugoHeneault

I'm using latest https://github.com/phonegap/phonegap-plugin-push to get some VoIP notifications. It's running well when the phone is unlocked even when the app has been killed.

But when I lock the phone, I got the cordova-call screen showing, but on answer my socket.io is not able to connect.

I already opened an issue on the plugin push repo (phonegap/phonegap-plugin-push#2245) but I think it's more related to CordovaCall than push plugin...

Did anyone get the calls working with webrtc while the screen is locked?

Here is a sample of my code:

pushObject.on('notification').subscribe(async (data: any) => {
    // even with app force closed, xcode shows this code in logs
    console.log("Push on notification", data);
    
    if (this.platform.is('ios')) {
         cordova.plugins.CordovaCall.receiveCall(data.additionalData.username);
    }
}


cordova.plugins.CordovaCall.on('answer', async () => {
     const socket = io(ENV.API_URL, {
          port: ENV.API_PORT,
          query: 'test'
     });

     socket.on('connected', () => {
          // this code never runs if the screen is locked
          // if we check in network tabs with safari open, we can see an infinite loading socket.io request
          console.log('connected');
     });
});

I need to create a socket.io connection to get ice and descriptions...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions