Page 1 of 1

Communicating with computer

Posted: Sat Sep 26, 2015 9:22 am
by Opaquer
Hey all

So, I want to make an app that I can use to use as a basic control for my computer (open internet sites and folders etc).

Is there a way that I can use Livecode to make an app for android that can communicate with my computer somehow, even if it's through another app on my computer?

Many thanks

Re: Communicating with computer

Posted: Sat Sep 26, 2015 9:47 am
by SparkOut
In version 7.1 sockets for android was introduced. I have tested it working to communicate with a computer from android and vice versa.
If your application on the computer listens for socket data from android and uses the data to determine how to respond it is perfectly possible. For instance when you press button 1 on the android and receive that data on the desktop, you can "launch URL..." or on receipt of data sent from button 2 you can "get shell(" whatever command line instruction you need to open a folder on your platform ")

Re: Communicating with computer

Posted: Sat Sep 26, 2015 10:06 am
by Opaquer
SparkOut wrote:In version 7.1 sockets for android was introduced. I have tested it working to communicate with a computer from android and vice versa.
If your application on the computer listens for socket data from android and uses the data to determine how to respond it is perfectly possible. For instance when you press button 1 on the android and receive that data on the desktop, you can "launch URL..." or on receipt of data sent from button 2 you can "get shell(" whatever command line instruction you need to open a folder on your platform ")
That sounds absolutely perfect! Is there a tutorial around I can use, or could you tell me a few quite things on how to use it :)?

Re: Communicating with computer

Posted: Sat Sep 26, 2015 10:24 am
by SparkOut
Look up in lessons.runrev.com for sockets tutorial. And in the resource centre menu in the idea down at the bottom of the sample stacks there is a chatrev stack you can use for ideas. If get chance ( using phone ATM here) I will see if I can make a basic pair of stacks for an example.

Re: Communicating with computer

Posted: Sat Sep 26, 2015 12:25 pm
by SparkOut
Here is a zipped file containing a pair of stacks, one for desktop, one for android.
They are ripped up from some of my apps in progress so there may be a bit of unnecessary stuff in there. There will be quite a bit of overkill on the resetting/closing/shutting down - if any sockets are left open then your standalone will close but the process will remain open in memory on the desktop, so I've been heavy handed there.
Try it and see.

Re: Communicating with computer

Posted: Sat Sep 26, 2015 5:21 pm
by SparkOut
Livecode lesson is here, btw: http://lessons.runrev.com/m/4071/l/1292 ... ng-sockets

Also these are possibly simpler and more instructive (thanks Bjoernke) : http://livecodeshare.runrev.com/stack/5 ... ket-server and http://livecodeshare.runrev.com/stack/5 ... ket-client