Friday, March 24, 2006

Skype Java API 2.0 Learning Notes (2) -- Sample Code Found

Finally, some sample codes for Java Skype API 2.0 are found.

1. Print out all the text chat message that received.

public class Main {
public static void main(String[] args) throws Exception {
final Object lock = new Object();
Skype.addMessageReceivedListener(new MessageReceivedListener() {
public void messageReceived(Message message) {
try {
System.out.println(message.getMessage());
} catch (SkypeException e) {
}
synchronized (lock) {
lock.notify();
}
}
});

synchronized (lock) {
lock.wait();
}
}

}

Note: Right now, I'm not sure why it need to aquire a lock in the code.

2. Code segment for answer the incoming call automatically.

Skype.addCallReceivedListener(new CallReceivedListener() {
public void callReceived(Call call) {
try {
call.answer();
} catch (SkypeException e) {
}
}
});

1 Comments:

At February 19, 2007 11:35 AM, Anonymous Anonymous said...

But in between, Tiger's lost 2 stroke play events in Asia and he just lost again this past week in Dubai. accommodationThat's their opinion. The modified Stableford system on the PGA tour is a thing of the past, as The International (a favorite among players because of the hospitality) was closed down forever. The decision has made TaylorMade the industry leader; three out of every 10 drivers sold have some version of its movable weight technology.

 

Post a Comment

<< Home