sincronizar

313 views
Skip to first unread message

Gabriel Antonio Romero Rojas

unread,
Nov 2, 2023, 8:01:54 PM11/2/23
to Sailforms Users
buenas noches.. me gustaria saber si es posible sincronizar mi aplicacion de sailforms pro que tengo en el celular en tiempo real con la tablet..  gracias

Paul Bowers

unread,
Nov 3, 2023, 4:53:42 AM11/3/23
to Sailforms Users
as it stands today - I dont see an easy automated solution for this. You can backup group programmatically or export table contents to CSV etc. But then you need to manually transfer to the tablet device and restore group or import file.

 I know people have been playing with URI message flow intents and I suspect this couple be done via a HTML solution route - like I have just done for the QRcode generator that passes data to the website - it could be made to do the same in reverse and pull data back using the clipboard as a transfer method etc. But you would need to build the JavaSctript app to receive, cache and the push the data around.

Paul Bowers

unread,
Nov 3, 2023, 6:22:39 AM11/3/23
to Sailforms Users
ClipSync – The easiest way to send text between computers and mobile devices with a simple copy paste (bdwm.be)

this may have some possibility - save to clipboard on one device - which is then synced to a PC server and pushed to the clipboard on the target device.

I will play and see how it goes.

Paul.

On Friday, 3 November 2023 at 00:01:54 UTC gabriel...@gmail.com wrote:

Paul Bowers

unread,
Nov 3, 2023, 7:14:37 AM11/3/23
to Sailforms Users

it looks like clipsync was built for older android versions - I am looking at https://www.pushbullet.com/ as a new capability

Paul Bowers

unread,
Nov 3, 2023, 7:39:07 AM11/3/23
to Sailforms Users
it looks like clipsync will still work on Android 12 and 13 and windows 11 - - PushBulltet is way over kill -
Message has been deleted
Message has been deleted

Paul Bowers

unread,
Nov 3, 2023, 5:25:47 PM11/3/23
to Sailforms Users
Clip sync is unstable and didn't really did what we want. So here are some
Rough prototypes of two apps to send and receive data between two devices
Lifting data from the clipboard and putting the received to the clipboard

That attached sailform demo shows you send and receive etc

For some reason the apps have to get in foreground as Android 12
Won't let me run then in the background. But it proves the principle that
We can't sync between to sailform apps using this method

These need to work to make more robust, but are usable to play.

To use. Launch the receiver on the destination device
On the sending device prime the clipboard with the data you want to send
Then execute the sender app to send.


I can't attach apk files here, so I'll drop them in Google drive...




Sync_demo_1.sfg

Paul Bowers

unread,
Nov 6, 2023, 4:14:36 AM11/6/23
to Sailforms Users
I have some excellent results in using the clipboard as a method of getting data in and out of Sailforms in realtime / near time or just as a method of syncing data between devices without having to resort to backup  / restore or export and import.

The attached example is one of my projects where I had a need to sync games and goals between my phone and tablet. There are two functions added - Sync Send and Sync Receive. I wanted to sync two tables - so Sync send executes two list process to extract the fields I want to sync and constructs a metatag record structure into a group variable - once they have done the button then dumps the group variable into the clipboard.

My App ClipSyncSend monitors the clipboard for data and when it sees some sends it to my receiver app ClipSyncRcv which i have launched on the desination device. This app received the data and dumps it into the clipboard.

Then on the destination device I click on Sync Receive to parse and update the two tables. And heypresto all synced.

I send the sync as a single blocked message - its more efficient and easier to do. I did play with individual messages - but its sluggish and way more complex to code in SailForms to wait for messages and process etc. I have tested a clipboard of upto 64K and its quite happy. One thing to note - dont put CRLF in the data as they are seen by the socket interface as end of record - I get SailFroms to convert them to %xx and then conver them back on the destination.

I have put updated apps on my GoogleDrive (cant attach them here - the forum blocks it)


The server apps will happily run in the background on my Lenovo tablet - but not on my samsung galaxy phone - this has some enhanced battery management and no matter what wakelock commands I issue and exclude them from restricted controls they still wait to be back in foreground - I am still researching on how to overcome this on Samsung devices. - So therefore I launch the send and receive apps on the two devices - then on the Samsung sender - in sailform press sync send to construct my data - then switch to my send app - which resumes and sends the data.

Screenshot_20231106-084944_Pro.jpg

Paul Bowers

unread,
Nov 27, 2023, 8:44:25 AM11/27/23
to Sailforms Users
I have been asked if it is possible to Sync the clip board between two devices using Bluetooth rather than over Wifi - as Wifi requires the two devices to be on the same network etc.

so here is a simple send/receive BTCLipSync app


the two devices need to be paired on BT int he normal way - but "send" sends the contents of the clipboard to the "receive" machine where it is placed in the clipboard of that machine

Once the message has been sent & received the apps end automatically.

There is no limit to the size of the message - the app will chunk it up into 1K blocks and reassemble at the other end.
I have tested upto 64K Sync Message.

If any one want the source for any apps then let me know.

Paul.

Paul Bowers

unread,
Nov 27, 2023, 9:00:16 AM11/27/23
to Sailforms Users
To keep things simple and easy I have used RFO-BASIC and BASIC! compiler to create the APK (If your using Android 10 and want to create an APK then use the HBASIC fork of RFO-BASIC to overcome the android file access permission changes. 

Tools for BASIC! - rfobasic (tapatalk.com)

the source for BTClipSync.bas is below



BT.OPEN

ARRAY.LOAD type$[], "Send Sync data", "Receive Sync data", "Quit"
title$ = "Bluetooth ClipSync v0.1"

new_connection:
xdomenu =0

SELECT type, type$[], title$

! If the user pressed the back
! key or selected quit then quit
! otherwise try to connect to
! a listener

PRINT "-----------------------------"
PRINT "Bluetooth Clipboard Sync"
PRINT "V0.1 Paul Bowers Nov 2023"
PRINT "-----------------------------"

IF (type = 0) | (type =3)
 PRINT "Session Closed"
 BT.CLOSE
 PAUSE 5000
 EXIT
ELSEIF type = 1
 BT.CONNECT
 PAUSE 1000
ENDIF

! Read status until
! a connection is made

DO
 BT.STATUS s
 IF s = 1
  PRINT "Waiting for connection, Press back to cancel"
 ELSEIF s =2
  PRINT "Destination acknowledged, Connecting"
 ELSEIF s = 3
  PRINT "Connected"
  BT.DEVICE.NAME device$
  IF type =1
   CLIPBOARD.GET wmsg$
   PRINT "Sending ";LEN(wmsg$) ;" bytes"
   BT.WRITE wmsg$
   PRINT "sent data to  "; device$
   DO
    ! wait until receiver had completed unbuffering.
    BT.STATUS d
    PAUSE 1000
   UNTIL d<>3
   BT.CLOSE
   EXIT
  ENDIF
 ENDIF
 PAUSE 1000
UNTIL s = 3

DO

 BT.STATUS s
 IF s<> 3
  PRINT "Connection lost"
  GOTO new_connection
 ENDIF

 ! Read messages until
 ! the message queue is
 ! empty

 buffer$=""
 CLS

 DO
  BT.READ.READY rr
  IF rr
   BT.READ.BYTES rmsg$
   IF rmsg$<>""
    buffer$=buffer$+rmsg$
   ENDIF
  ENDIF
 UNTIL rr = 0
 CLIPBOARD.PUT buffer$
 NOTIFY "BT ClipSync Receive","Data received","and is ready for processing",0
UNTIL rr=0
BT.CLOSE
EXIT

ONERROR:
err$=GETERROR$()
DIALOG.MESSAGE err$,"",a,"Continue"
IF a=1
 GOTO new_connection
ENDIF

EXIT


====================================================================
The source for IP ClipSync Receive
====================================================================

PRINT "Sailforms Point to Point Sync Server"
PRINT "Paul Bowers v0.3 November 2023"
PRINT "---------------------------------------"
PRINT
PRINT "connection will auto end on receipt of data"
PRINT "This app can run in the background and"
PRINT "issue a notification on receipt of data"
PRINT

port=1080

SOCKET.MYIP ip$
PRINT "LAN IP: " + ip$
GRABURL ip$, "http://icanhazip.com"
PRINT "WAN IP: " + ip$

line$=""
line2$=""
SOCKET.SERVER.CREATE port

newConnection:

PRINT "Waiting for client connect"
SOCKET.SERVER.CONNECT 0
DO
 SOCKET.SERVER.STATUS st
UNTIL st = 3

SOCKET.SERVER.CLIENT.IP ip$
PRINT "Connected to ";ip$

maxclock = CLOCK() + 90000
line$ = "Wait"

HOME

DO

 SOCKET.SERVER.READ.READY flag
 IF CLOCK() > maxclock
  PRINT "Read time out"
  END
 ENDIF

UNTIL flag
SOCKET.SERVER.READ.LINE line$

CLIPBOARD.PUT line$

NOTIFY "ClipSync Receive","Data received","",0
SOCKET.SERVER.WRITE.LINE "ACK"

SOCKET.SERVER.DISCONNECT
PRINT "Disconnected from client"
EXIT

ONBACKGROUND:

IF BACKGROUND()=1
 maxclock = CLOCK() + 90000
 line$ = "Wait"
 DO
  SOCKET.SERVER.READ.READY flag
  IF CLOCK() > maxclock
   ! PRINT "Read time out"
   END
  ENDIF
 UNTIL flag
 SOCKET.SERVER.READ.LINE line$
 NOTIFY "ClipSync Receive","Data received","",0
 CLIPBOARD.PUT line$
 SOCKET.SERVER.WRITE.LINE "ACK"
ENDIF
EXIT
BACKGROUND.RESUME

ONERROR:

err$=GETERROR$()
DIALOG.MESSAGE err$,"",a,"Continue"
EXIT

========================================================
and source for IP ClipSync Send
========================================================

PRINT "--------------------------------------"
PRINT "Sailforms point to point Sync client"
PRINT "Paul Bowers v0.3 November 2023"
PRINT "--------------------------------------"
CONSOLE.TITLE "ClipSync Send"


PRINT "ClipSyncSend.txt contains config"
line$=""

main:

DO

FILE.EXISTS fn, "clipsyncsend.txt"
 IF fn <>0
  TEXT.OPEN R, FN2, "clipsyncsend.txt"
  TEXT.READLN FN2, ip$
  PRINT "connecting to ";ip$
  TEXT.CLOSE FN2
 ELSE
  INPUT "Enter the target device IP", ip$, "192.168.0.122"
  HOME
 ENDIF

 port=1080
 print "Connecting..."
 SOCKET.CLIENT.CONNECT ip$, port

 DO
  CLIPBOARD.GET cg$
  IF cg$<> ""
   SOCKET.CLIENT.WRITE.LINE cg$
   CLIPBOARD.PUT ""
   DO
    SOCKET.CLIENT.READ.READY flag
    maxclock = CLOCK() + 20000
    IF CLOCK() > maxclock
     NOTIFY "ClipSync send","session timeout","",0
     END
    ENDIF
   UNTIL flag
   SOCKET.CLIENT.READ.LINE line$
   IF line$="ACK"
    NOTIFY "ClipSync send","Data sent & acknowledged","",0
    SOCKET.SERVER.DISCONNECT
    EXIT
   ENDIF
  ENDIF
  line$="OFF"
 UNTIL line$="OFF"

 SOCKET.SERVER.DISCONNECT
ENDIF

UNTIL line$="OFF"

EXIT

ONBACKGROUND:

IF BACKGROUND()=1

 FILE.EXISTS fn, "clipsyncsend.txt"
 IF fn <>0
  TEXT.OPEN R, FN2, "clipsyncsend.txt"
  TEXT.READLN FN2, ip$
  PRINT "connecting to ";ip$
  TEXT.CLOSE FN2
 ELSE
  INPUT "Enter the target device IP", ip$, "192.168.0.122"
  HOME
 ENDIF

 port=1080
 print "Connecting..."
 SOCKET.CLIENT.CONNECT ip$, port

 DO
  CLIPBOARD.GET cg$
  IF cg$<> ""
   SOCKET.CLIENT.WRITE.LINE cg$
   CLIPBOARD.PUT ""
   DO
    SOCKET.CLIENT.READ.READY flag
    maxclock = CLOCK() + 20000
    IF CLOCK() > maxclock
     NOTIFY "ClipSync send","session timeout","",0
     END
    ENDIF
   UNTIL flag
   SOCKET.CLIENT.READ.LINE line$
   IF line$="ACK"
    NOTIFY "ClipSync send","Data sent & acknowledged","",0
    SOCKET.SERVER.DISCONNECT
    EXIT
   ENDIF
  ENDIF
  line$="OFF"
 UNTIL line$="OFF"

 SOCKET.SERVER.DISCONNECT
ENDIF

BACKGROUND.RESUME

ONERROR:

PRINT "Waiting...."
PAUSE 3000
GOTO main

EXIT

onbackkey:

INPUT "Enter the target device IP", ip$, "192.168.0.122"
backkey.resume


Reply all
Reply to author
Forward
0 new messages