1

I am using firebase to send Json thru my CN1 app. This is my code and it's working fine, but I want to send the stuff to Dropbox instead and I just can't make it work. (I already got my token, key and secret from their site)

Could you please tell me what I need to change in order to be able to upload my stuff into Dropbox?

   @Override
protected void onPrincipal_ButtonJsonAction(Component c, ActionEvent event) {

    final String data = Result.fromContent(hashtableWithInfo).toString();
    String firebase = "https://fire-game-258.firebaseio.com/example.json";

    ConnectionRequest request = new ConnectionRequest() {
        @Override
        protected void buildRequestBody(OutputStream os) throws IOException {
            os.write(data.getBytes("UTF-8"));
        }
    };
    request.setUrl(firebase);
    request.setPost(true);
    request.setHttpMethod("POST");
    request.setContentType("application/json");
    NetworkManager.getInstance().addToQueueAndWait(request);
}

Many many many thanks.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
Felipe
  • 527
  • 2
  • 9

1 Answers1

2

Firebase and Dropbox are completely different API's and need to go thru completely different processes. Saving a file to dropbox requires an OAuth process for the specific user whereas firebase is a global API.

I would recommend you look at parse which more closely resembles firebase and already has standardized builtin mappings in Java: https://github.com/sidiabale/parse4cn1/

Shai Almog
  • 51,749
  • 5
  • 35
  • 65