jefflinwood / twilio_client_phonegap

Phonegap plugins for the Twilio Client iOS and Android SDKs
MIT License
59 stars 53 forks source link

What is a good place to call device.connect() in iOS? #53

Closed gnumbers closed 8 years ago

gnumbers commented 8 years ago

I tried to make an out-going call in device.ready, but it returns connection instead of device. This is different from Twilio-js. Can anyone help me with this?

jefflinwood commented 8 years ago

Hi,

You'd call:

connection = Twilio.Device.connect(params);

It should work in Twilio.Device.ready(function (device) {})

gnumbers commented 8 years ago

@jefflinwood Thanks for your reply. But the instance of connection is returned via device in the callback. I can't really understand it.

jefflinwood commented 8 years ago

Hi,

Take a look at the example app:

https://github.com/jefflinwood/TwilioClientPhoneGapExampleApp/tree/master/www/js

The plugin does work differently from Twilio's JS Client.

gnumbers commented 8 years ago

Thanks, I will take a look. I forgot to mention that i am using the fork repo of yours. https://github.com/crossroads/twilio_client_phonegap It may be an issue?

jefflinwood commented 8 years ago

So that one looks like they renamed Twilio.Device to TwilioClient.Device, so that could be a factor.

gnumbers commented 8 years ago

Yes, my code covers it already. I just created a skeleton cordova project and applied your example project. It apparently returns connection through the device variable here. Twilio.Device.ready(function (device) { console.log (device); // this returns connection $('#statusMessage').text('Ready to start call'); });