jefflinwood / twilio_client_phonegap

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

Starting Hello Monkey Application #29

Closed thisismav closed 9 years ago

thisismav commented 9 years ago

Hello everybody. I hope somebody can help me to solve my issues. Ive added the twilio plugin to my cordova ios project. Worked well. Ive added the header und lib files. But from now on i dont know how to start the whole thing. Ive tried the "Hello Monkey" example from the Twilio docs but it does not work on my App. Can somebody show me what i am doing wrong? For the token i uploaded the php files from twilio to my ftp and generated there my token with my account details. Then i put the token into my app and tried it, but it dont work on simulator and iphone device.

Its just the Test Call to see if everything works. Here is my code, just the index.html

   <html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>

    </head>
    <body>
      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      <script type="text/javascript" src="js/tcPlugin.js"></script>

<script type="text/javascript">

    Twilio.Device.setup("HERE IS MY TOKEN");

    Twilio.Device.ready(function (device) {
                        $("#log").text("Ready");
                        });

                        Twilio.Device.error(function (error) {
                                            $("#log").text("Error: " + error.
                                                           message);
                                            });

                                            Twilio.Device.connect(function (conn) {
                                                                  $("#log").text("Successfully established call");
                                                                  });

                                                                  function call() {
                                                                      Twilio.Device.connect();
                                                                  }
</script>
</head>
<body>
    <button class="call" onclick="call();">
        Call
    </button>

    <div id="log">Loading pigeons...</div>
</body>
</html>
jefflinwood commented 9 years ago

Hi,

What's appearing in the log? Are you loading the tcPlugin.js from your index.html? If you want to post your whole index.html, I can look at it. You can also use the remote debugger in Safari to take a look at the error console for Cordova when you run the app in the Simulator.

thisismav commented 9 years ago

Yeah, here is the complete index.html. I have to say that i "echo" the token from my php file and copy paste it into the code for testing reasons. Does this work? And thanks for your help.

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="msapplication-tap-highlight" content="no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>

    </head>
    <body>
      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      <script type="text/javascript" src="js/tcPlugin.js"></script>

<script type="text/javascript">

    Twilio.Device.setup("HERE IS MY TOKEN");

    Twilio.Device.ready(function (device) {
                        $("#log").text("Ready");
                        });

                        Twilio.Device.error(function (error) {
                                            $("#log").text("Error: " + error.
                                                           message);
                                            });

                                            Twilio.Device.connect(function (conn) {
                                                                  $("#log").text("Successfully established call");
                                                                  });

                                                                  function call() {
                                                                      Twilio.Device.connect();
                                                                  }
</script>
</head>
<body>
    <button class="call" onclick="call();">
        Call
    </button>

    <div id="log">Loading pigeons...</div>
</body>
</html>
thisismav commented 9 years ago

Sorry for double posting, maybe you can help me out with an Version how you would do the "Hello Monkey" Example of Twilio. That would help to understand the whole thing.

https://www.twilio.com/docs/quickstart/php/client/hello-monkey

I think this would help a lot of People to getting started.

jefflinwood commented 9 years ago

Hi,

I just uploaded the example application I use for testing the plugin.

My version requests the token from a URL - if you have a URL endpoint that just returns a Twilio capability token, replace the URL at the bottom of phoneApp.js with that.

Let me know if that helps!

jefflinwood commented 9 years ago

https://github.com/jefflinwood/TwilioClientPhoneGapExampleApp

thisismav commented 9 years ago

Worked fine! Thank you very very much!

jefflinwood commented 9 years ago

Thanks! I'm glad it helped! If you have any questions, create a new issue on this repo or that example app repo. I'll close out this issue.