Corona & Dropbox

Hi,
does anyone have experience how i would connect to dropbox from my
app, save a file there and than when needed download that file again?

at all the idea would offer a multi platform option to sync settings between
iOS and Android devices!

Any idea, source, how to realize that from within corona dropbox
is appreciated.

thx
chris

[import]uid: 4795 topic_id: 26226 reply_id: 326226[/import]

Hi.

That’s exactly the way I use Dropbox. That way I can switch between my PC and Mac. All I did was to install the Dropbox software both PC and Mac. Then in PC, Dropbox should appear in your document folder(same in Mac but I am not sure of the name there) You can open the project using that location. I use Cider or CPM.

The great thing is that I can be relatively assured that my code is safe from one my computer crashing since it is also on Dropbox (and both computer)

Hope this help

Mo [import]uid: 100814 topic_id: 26226 reply_id: 106306[/import]

hi thanks for your response.

but does that work from WITHIN my corona app.

its not about to load data from mac to dropbox
instead i like that when a user ends my app
the settings are uploaded to dropbox

when he opens another app with same account
it will download the latest upload

thx
chris
[import]uid: 4795 topic_id: 26226 reply_id: 106307[/import]

Oh Sorry Chris! I thought you were asking about using Dropbox to develop apps both in PC and Mac. In term of uploading data from a Corona app to Dropbox, I frankly do not know. I do suggest to try and see if Dropox box has an REST API you can use from Corona/ That’s the only thing i can think of. Please note that I know very little about network but I am sure bunch of people can help on that here.

Sorry about that again.

Mo

EDIT: https://www.dropbox.com/developers [import]uid: 100814 topic_id: 26226 reply_id: 106313[/import]

i saw they have kind a api… but looks quiet complicated… haha.
i will have a deeper look into it soon… just someone already have some experiences :slight_smile:

greets
chris
[import]uid: 4795 topic_id: 26226 reply_id: 106318[/import]

Yes I think so too but I believe in term of REST API, it is pretty typical. Here some links I found that deal with integrating dropox into ios and android apps.
IOS:
http://www.mathiastauber.com/category/code-snippets/

ANDROID:
http://www.techrepublic.com/blog/app-builder/integrating-dropbox-in-my-surveillance-android-app/830

Obviously those are not made for Corona but it may give an idea on how to proceed.

…But you right nothing beat having someone who already did it with Corona and he/she willing to share. I will also love it if Ansca could integrate dropbox directly into Corona! They are so many things we could do:)

Good luck Chris.

Mo [import]uid: 100814 topic_id: 26226 reply_id: 106323[/import]

thanks… yeah would be great if someone did already and would share his experience !!!

if someone is here… please post a comment :slight_smile:

chris
[import]uid: 4795 topic_id: 26226 reply_id: 106336[/import]

hi again.

ok, i am more far with the topic.

just problem by changing the request token into a access token

poststring = “https://api.dropbox.com/1/oauth/request_token?oauth_consumer_key=” … appkey … “&oauth_signature_method=PLAINTEXT&oauth_signature=” … appsecsig … “%26&oauth_timestamp=” … mytimestamp … “&oauth_nonce=” … authnonce …"&oauth_version=1.0"
network.request( poststring, “POST”, networkListener, params)
–>works fine

  1. WebView so User can confirm request
    –> works fine

poststring = “https://api.dropbox.com/1/oauth/access_token?oauth_consumer_key=” … appkey … “&oauth_nonce=” … authnonce … “&oauth_signature_method=HMAC-SHA1” … “&oauth_timestamp=” … mytimestamp … “&oauth_token=” … authtoken … “&oauth_token_secret=” … authtokensecret … “&oauth_signature=” … authtokensecret … “&oauth_version=1.0”

–> here i have a prob. seems as I can’t use PLAINTEXT as Signature_Method I have to encode the oauth_signature… but all my tries did not helped!
Any Ideas. Do i have to do both time (step 1 & 3) the same signature_Method, or how to build the right now for step 3 or even 1&3 if its HMAC-SHA1

really if you have a solution, let me know… its the last step :slight_smile:

thx
chris
[import]uid: 4795 topic_id: 26226 reply_id: 106521[/import]

You might want to look at the Twitter app in the Sample code. It includes an oauth.lua module which might save you some pain in getting through the OAUTH part of the Dropbox API [import]uid: 19626 topic_id: 26226 reply_id: 106545[/import]

i came already further… now its about UPLOADING a file to dropbox, via corona …

still any help appreciated

[import]uid: 4795 topic_id: 26226 reply_id: 106669[/import]

guruk,
I’m trying to get the Dropbox REST API to work also. I see that you’ve had some success with request_token. Would you be willing to share the code that worked?

Also, I’ve had some luck in switching from HMAC SHA1 to PLAINTEXT. I’d be happy to share what I came up with for that. [import]uid: 104085 topic_id: 26226 reply_id: 120003[/import]

guruk,
I’m trying to get the Dropbox REST API to work also. I see that you’ve had some success with request_token. Would you be willing to share the code that worked?

Also, I’ve had some luck in switching from HMAC SHA1 to PLAINTEXT. I’d be happy to share what I came up with for that. [import]uid: 104085 topic_id: 26226 reply_id: 120003[/import]

Anyone have any luck integrating dropbox/oauth ? Thanks in advance. [import]uid: 79594 topic_id: 26226 reply_id: 123075[/import]

Yes. I’m sorry I did not update. The good folks here at Corona looked at my code and they discovered that I was not using the Dropbox REST API correctly. Here is the correction:

Hi Michael, the problem was not a bug on Corona but a misunderstanding of the dropbox api.

I have not used the dropbox api before, however from reading the below page:

As described here: http://www.rubydoc.info/github/futuresimple/dropbox-api/Dropbox/API/Connection/Requests#post-instance_method

You can see that the post request expects a blank header to be sent.

Removing:

Headers = {}

And having your params table like so:

local params = {}
params.body = body

Your example code worked perfect in my testing on Android.

I have attached the updated sample to this email for you to try out.

Unfortunately, there is no way to post a sample project to this forum. So, I will need a little time to fix my project and then I’ll post it in the code exchange! Sorry for the delay. So busy!
[import]uid: 104085 topic_id: 26226 reply_id: 123077[/import]

Thanks Michael. I look forward to seeing the final code ! [import]uid: 79594 topic_id: 26226 reply_id: 123116[/import]

If you have a Dropbox account you can share a link to a zipped file to make your project available. [import]uid: 8271 topic_id: 26226 reply_id: 123117[/import]

Anyone have any luck integrating dropbox/oauth ? Thanks in advance. [import]uid: 79594 topic_id: 26226 reply_id: 123075[/import]

Yes. I’m sorry I did not update. The good folks here at Corona looked at my code and they discovered that I was not using the Dropbox REST API correctly. Here is the correction:

Hi Michael, the problem was not a bug on Corona but a misunderstanding of the dropbox api.

I have not used the dropbox api before, however from reading the below page:

As described here: http://www.rubydoc.info/github/futuresimple/dropbox-api/Dropbox/API/Connection/Requests#post-instance_method

You can see that the post request expects a blank header to be sent.

Removing:

Headers = {}

And having your params table like so:

local params = {}
params.body = body

Your example code worked perfect in my testing on Android.

I have attached the updated sample to this email for you to try out.

Unfortunately, there is no way to post a sample project to this forum. So, I will need a little time to fix my project and then I’ll post it in the code exchange! Sorry for the delay. So busy!
[import]uid: 104085 topic_id: 26226 reply_id: 123077[/import]

Thanks Michael. I look forward to seeing the final code ! [import]uid: 79594 topic_id: 26226 reply_id: 123116[/import]

If you have a Dropbox account you can share a link to a zipped file to make your project available. [import]uid: 8271 topic_id: 26226 reply_id: 123117[/import]