WebsiteBeaver / CordovaCall

Cordova CallKit & ConnectionService plugin for iOS/Android that displays the native call UI for VOIP apps
MIT License
196 stars 91 forks source link

Android device "recent calls" are all "Unknown" #35

Closed rcorrie closed 6 years ago

rcorrie commented 6 years ago

Thanks for the component! I have got it working well except for this one issue. All the calls I receive to my voip app are showing up as "Unknown" in the device's native Recent Calls app.

I am calling cordova.plugins.CordovaCall.receiveCall('BOB');

The incoming notification looks good:

screen shot 2018-04-20 at 10 04 11 pm

But then once it view it in the log, it's shows "Unknown" instead of "BOB":

screen shot 2018-04-20 at 10 04 24 pm

Edit: In the worst case scenario, I rather nothing show up on the "Recent Calls" log, anyway of doing this?

D-Marc1 commented 6 years ago

Hey @rcorrie, unfortunately Android doesn't give you control over changing the recent call name. There's also no way of preventing it from going in there the first place.

Android ConnectionService needs to catch up to iOS CallKit in many ways, and this is certainly an area it needs to improve in. It's not very intuitive to just have 'Unknown' show up in your recent calls.

rcorrie commented 6 years ago

Thanks for the reply @D-Marc1, and again thanks for the awesome work. Yeah it's a shame that Android hasn't gotten around to better documenting and fleshing out this API.

What I ended up doing is writing a BroadcastReceiver that will watch the phone state. Whenever the phone state changes to idle, it deletes any call log item matching my phoneAccount ID. The downside is that we need to ask for write permissions for the call log.

switch (state) {
    case TelephonyManager.CALL_STATE_IDLE:
        String query = CallLog.Calls.PHONE_ACCOUNT_ID+"=?";
        this.context.getContentResolver().delete(CallLog.Calls.CONTENT_URI, query, new String[]{"MY_PHONE_ACCOUNT_ID"});
...
D-Marc1 commented 6 years ago

I can't take credit for this amazing plugin, as this is all @dmarcs' hard work.

It's actually quite shocking how terrible the implementation is of ConnectionService. If I'm not mistaken, Google Hangouts doesn't even use it, ironically. Hopefully they'll fix most of its issues next version.

That's a good idea, and we've thought of doing that too. It's really a tradeoff type of situation.

rcorrie commented 6 years ago

Do you guys have any idea how apps like Whatsapp, Line, etc. manage their calling? I thought they were leveraging ConnectionService, but I don't see how that is possible.

D-Marc1 commented 6 years ago

Ya, you would think so, considering they all use CallKit for iOS. Even Google doesn't bother with its own creation, but uses the iOS version.

TBH, the best solution for Android is to force open your app and create a custom answering dialogue. This is what they all use currently. ConnectionService has a lot of potential, but they decided to not give much thought to it, along with poorly documenting it.

andrewvmail commented 6 years ago

Yo @rcorrie check out #36

rcorrie commented 6 years ago

@andrewvmail thanks, yeah I'm eventually going to have to write my custom android module. Some of the ConnectionService weirdness is unacceptable.