Help - Search - Members - Calendar
Full Version: couple of java questions
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
aectx_
I've downloaded the current version of the Skype java library tarball and have come up with the following questions:

First, it appears that the Call class contains all of the functionality needed to make use of the CallStatusChangedListener. However, when I attempt to actually use a listener, its method is never called. Additionally, attempts to run the CallStatusTest included in the package of JUnit tests fails with the error that the assertion failed; it appears that the listener's method in that test is not being called either. Further inspection of the code in the Call class revealed that the method to fire the status changed event is never actually being called. Is there some other way to enable this functionality? It looked as though it would be a simple matter of adding a line to the setStatus method that would fire the event but this has not corrected the problem.

Second, I am wondering if it is possible to create a stand-alone application using the java library? That is, is it possible to build a java application that uses this library and will run on a machine which does not have the Skype client software installed? If not, is it at least possible to make calls from a java application without having the Skype client's GUI dialogs popping up?

Thank you for whatever information you can give me.
xic_
Hi,

Thank you for your intrest in the Java API.
Please update that tarball regularly as changes are made everyday.

From today you will find in the tarball, in the release directory a skype_full.jar.
If you use this (and distribute it with your own application jar) the other user only has to have a JRE and Skype installed (and running).

By using the API a java program can control calls, chats, voicemails, etc.
A Java app cannot directly connect to Skype, this is what the Skype client is needed for, once the Skype client is connected/logged in, the Java API can do loads of stuff for you.

Most Linux and Mac users have already JRE 1.5 installed so making a Java app is really easy and protable.
Not many users on Windows have a JRE 1.5 installed, though this is needed.

I will look into the Call listener not being called.
xic_
Try this code:

CODE


package net.lamot.skypesnippets;



import com.skype.Call;

import com.skype.CallAdapter;

import com.skype.Skype;

import com.skype.SkypeException;



public class CallListenerSnippet {



private static final Object lock = new Object();



public CallListenerSnippet() throws SkypeException {

 Skype.setDebug(true);

 Skype.addCallListener(new CallAdapter() {

  @Override

  public void callReceived(Call call) throws SkypeException {

   System.out.println("callReceived() start");

   System.out.println("Called by: "+call.getPartnerId());

   synchronized(lock) {

    lock.notify();

   }

   System.out.println("callReceived() end");

  }

 });

}



public static void main(String args[]) {

 System.out.println("main() start");

 

 try {

  CallListenerSnippet clsnip = new CallListenerSnippet();

  //wait for a call.

  synchronized(lock) {

   try {

    lock.wait();

   } catch (InterruptedException e) {

   }

  }

 } catch (SkypeException e) {

  e.printStackTrace();

 }

 

 System.out.println("main() end");

 System.exit(0);

}

}

noahweiss
Hi, thanks for the very useful code snippet. I got the code running for a while with Skype 3.0 beta, but all of a sudden it started to crash. Any ideas? Here's the console output including the error message:

main() start
com.skype.NotAttachedException
at com.skype.Utils.convertToSkypeException(Utils.java:36)
at com.skype.Skype.setDebug(Skype.java:116)
at CallListenerSnippet.<init>(CallListenerSnippet.java:22)
at CallListenerSnippet.main(CallListenerSnippet.java:58)
Caused by: com.skype.connector.NotAttachedException
at com.skype.connector.Connector.assureAttached(Connector.java:580)
at com.skype.connector.Connector.addConnectorListener(Connector.java:604)
at com.skype.connector.Connector.addConnectorListener(Connector.java:591)
at com.skype.connector.Connector.setDebug(Connector.java:209)
at com.skype.Skype.setDebug(Skype.java:114)
... 2 more
main() end
zhazaa
QUOTE(noahweiss @ Fri Nov 10 2006, 04:41) [snapback]318045[/snapback]

Hi, thanks for the very useful code snippet. I got the code running for a while with Skype 3.0 beta, but all of a sudden it started to crash. Any ideas? Here's the console output including the error message:

main() start
com.skype.NotAttachedException
at com.skype.Utils.convertToSkypeException(Utils.java:36)
at com.skype.Skype.setDebug(Skype.java:116)
at CallListenerSnippet.<init>(CallListenerSnippet.java:22)
at CallListenerSnippet.main(CallListenerSnippet.java:58)
Caused by: com.skype.connector.NotAttachedException
at com.skype.connector.Connector.assureAttached(Connector.java:580)
at com.skype.connector.Connector.addConnectorListener(Connector.java:604)
at com.skype.connector.Connector.addConnectorListener(Connector.java:591)
at com.skype.connector.Connector.setDebug(Connector.java:209)
at com.skype.Skype.setDebug(Skype.java:114)
... 2 more
main() end


Hello,

I'm having the same problem, exactly the same exception.
Do you have any clue about what could be ?

Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.