Communicating with computer

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Communicating with computer

Post by Opaquer » Sat Sep 26, 2015 9:22 am

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Communicating with computer

Post by SparkOut » Sat Sep 26, 2015 9:47 am

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 ")

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: Communicating with computer

Post by Opaquer » Sat Sep 26, 2015 10:06 am

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 :)?

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Communicating with computer

Post by SparkOut » Sat Sep 26, 2015 10:24 am

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.

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Communicating with computer

Post by SparkOut » Sat Sep 26, 2015 12:25 pm

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.
Attachments
SocketsSampler.zip
Sockets on Android sampler
(5.39 KiB) Downloaded 273 times

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Communicating with computer

Post by SparkOut » Sat Sep 26, 2015 5:21 pm

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

Post Reply