Dropbox Sync

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Forum rules
New release: CSPro 8.0
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dropbox Sync

Post by josh »

Next time please start a new topic rather than resurrecting and old one.

There is currently no way to deploy a new application to a tablet via Dropbox. We are working a new way of doing this but it won't be ready for a while yet. In the meantime you will need to copy via USB use other software to download the files.

Once you have the application deployed to the tablet you can use sync to update the pen and pff files as well as to send the data to Dropbox.
Abel
Posts: 6
Joined: July 26th, 2017, 10:02 am

Re: Dropbox Sync

Post by Abel »

Hi Dear Jos, I am using Sync Connect function using Dropbox.


function SyncToHQ()
if syncconnect(Dropbox) then
syncdata(PUT,MODULE_1_DICT);
syncdata(PUT,MODULE2_DICT);
syncdata(PUT,MODULE3_DICT);

syncfile(GET,"KAP/MODULE1.pen");
syncfile(GET,"KAP/MODULE2.pen");
syncfile(GET,"KAP/MODULE3.pen");

syncdisconnect();

endif;
end;

but I get error message on the smart phone as follow.
Error connecting to sync server: Java.net.UnkownHostException: Unable to resolve host "api.dropboxapi.com": No adress associated with hostname.

Is there any thing missed in my Function??

Thanks
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dropbox Sync

Post by josh »

That error doesn't have anything to do with the code. It seems like you do not have internet access on your smart phone or the network you are connected to is blocking Dropbox. Can you connect to http://www.dropbox.com from the web browser on your phone?
Abel
Posts: 6
Joined: July 26th, 2017, 10:02 am

Re: Dropbox Sync

Post by Abel »

Thanks Josh, Now it sync successfully to the drop box. and it creates CSPro folder then DataSync/Dictionery name/ data/...
I try to download the from the data viewer, i fail to connect to drop box, i think it may be the internet connection (but i can open the drobox from my browser).Is there any other way to open the files in the drop box in csdb format?
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dropbox Sync

Post by josh »

In addition to using the data viewer you can write a CSPro application that uses the sync functions to download from the Dropbox. Just replace the "PUT" with "GET" in the code you have already:

if syncconnect(Dropbox) then
syncdata(GET,MODULE_1_DICT);
syncdata(GET,MODULE2_DICT);
syncdata(GET,MODULE3_DICT);
syncdisconnect();

Just make sure to add those as external dictionaries to your application.
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: Dropbox Sync

Post by arkagwa »

Dear Josh and Others

In dropbox sync, when i add .pff and .pen files in dropbox server does sync also download updated version of lookup file to the data entry person?? If normal sync can not update lookup files what should i do then??
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dropbox Sync

Post by josh »

Two options:

1. Add your lookup file into a resource folder so that it gets built into the pen file. That way if you update the pen file the lookup file gets updated too. You don't need to make any changes to your sync settings/code at all. See "resource folder" in the help for details on how to create a resource folder.

2. Use sync from logic and add a syncdata(GET,...) call to sync your lookup file. The logic would look something like:
// connect to Dropbox
if syncconnect(Dropbox) then

    
// get the latest versions of the application files from Dropbox
    syncfile(GET,"/MyApp/MyApp.pff");
    
syncfile(GET,"/MyApp/MyApp.pen");

    
// send the latest cases to Dropbox
    syncdata(PUT,SURVEY_DICT);

    
// download lookup file from Dropbox
    syncdata(GET, LOOKUP_DICT);  

    
syncdisconnect();

endif;
This would go in a menu program like in the "Synchronization in Logic" example.

Option one is easier if you don't already have a menu program with sync logic in it so I would recommend you go with that.

By the way, next time please start a new topic rather than adding a new question to one that was already answered.
Abel
Posts: 6
Joined: July 26th, 2017, 10:02 am

Re: Dropbox Sync

Post by Abel »

josh wrote:In addition to using the data viewer you can write a CSPro application that uses the sync functions to download from the Dropbox. Just replace the "PUT" with "GET" in the code you have already:

if syncconnect(Dropbox) then
syncdata(GET,MODULE_1_DICT);
syncdata(GET,MODULE2_DICT);
syncdata(GET,MODULE3_DICT);
syncdisconnect();

Just make sure to add those as external dictionaries to your application.

Thanks Josh.
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: Dropbox Sync

Post by arkagwa »

Dear Josh

I have gone through help and i have added "UG LOOKUP" as a resource folder. More over i have added only .pen and .pff files in dropbox but sync does not update "UG lookup.dat" to a data entry PC/person. Just a question, what shoul be the contents and folder structure in dropbox "UG FORM".

Currently i have only .pen and .pff files only


josh wrote:Two options:

1. Add your lookup file into a resource folder so that it gets built into the pen file. That way if you update the pen file the lookup file gets updated too. You don't need to make any changes to your sync settings/code at all. See "resource folder" in the help for details on how to create a resource folder.

2. Use sync from logic and add a syncdata(GET,...) call to sync your lookup file. The logic would look something like:
// connect to Dropbox
if syncconnect(Dropbox) then

    
// get the latest versions of the application files from Dropbox
    syncfile(GET,"/MyApp/MyApp.pff");
    
syncfile(GET,"/MyApp/MyApp.pen");

    
// send the latest cases to Dropbox
    syncdata(PUT,SURVEY_DICT);

    
// download lookup file from Dropbox
    syncdata(GET, LOOKUP_DICT);  

    
syncdisconnect();

endif;
This would go in a menu program like in the "Synchronization in Logic" example.

Option one is easier if you don't already have a menu program with sync logic in it so I would recommend you go with that.

By the way, next time please start a new topic rather than adding a new question to one that was already answered.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dropbox Sync

Post by josh »

You only need the pen and pff file. If you create a resource folder and put your lookup file inside the resource folder then the lookup file gets added to the pen file when you publish the pen file. The pen file is kind of like a zip file. When you run the pen file on your device the resources folder and all of its contents are extracted from the pen file onto the tablet.
Post Reply