Taracque / ionic-plugin-callkit

Ionic/Cordova plugin for CallKit
36 stars 20 forks source link

Handling calls from the native dialer #4

Open manur opened 7 years ago

manur commented 7 years ago

Firstly, thanks for publishing this. It works pretty nicely.

In iOS at least, a contact can be selected from the native dialer's call list, which reports the event to the VoIP app. But, it doesn't seem to forward any data about the contact that was clicked.

Is this already available or currently planned in your roadmap? If not planned, I would appreciate guidance on how to go about integrating and I'd be happy to submit a PR.

Thanks

Taracque commented 7 years ago

It is on my list, but wit low priority. If you need that functionality and you have time to implement here is what I know about this: An INExtension should be created, which handles the launching data. https://developer.apple.com/reference/intents/inextension (This is more SiriKit thing than CallKit)

To make this works the AppDelegate needs an application continue userActivity method.

De-Lac commented 7 years ago

actually, it works.. it gives all the data about a contact. However, I've installed the plugin ionic cordova plugin add cordova-plugin-contacts I am on IOS 10.2.1 This is an example of a contact selected:

  "id": 18,
  "rawId": null,
  "displayName": null,
  "name": {
    "givenName": "Alberico",
    "honorificSuffix": null,
    "formatted": "Alberico",
    "middleName": null,
    "familyName": "",
    "honorificPrefix": null
  },
  "nickname": null,
  "phoneNumbers": [
    {
      "value": "+390000000",
      "pref": false,
      "id": 0,
      "type": "mobile"
    }
  ],
  "emails": null,
  "addresses": null,
  "ims": null,
  "organizations": null,
  "birthday": null,
  "note": null,
  "photos": [
    {
      "value": "/var/mobile/Containers/Data/Application/740500C4-801D-494A-B707-DE0E88CEE7B8/tmp/contact_photo_18",
      "type": "url",
      "pref": "false"
    }
  ],
  "categories": null,
  "urls": [
    {
      "value": "https://www.facebook.com/.....",
      "pref": false,
      "id": 0,
      "type": "facebook"
    }
  ]
}

this is the method I've used to get that result

 this.pickContactUsingNativeUI = function() 
       {       
        navigator.contacts.pickContact(
          function(contactPicked)
            { /* contactPicked is the result */},
          function(err)
            { console.log('Error: ' + err); 
            });
        }