I'm trying to use JSch to send AppleScript to my Apple device. My code sends a 'playpause' command to iTunes and works but only twice. After the third click of the button, the code doesn't work any longer.
Can you guys tell me why?
Code:
public void onPlayPauseClick(View view){
channel.setCommand("osascript -e 'tell app \"iTunes\" to playpause'");
Log.i("Button", "Pressed play");
try {
channel.connect();
} catch (JSchException e) {
e.printStackTrace();
}
}