How to display dropbox download url after upload from custom Android app - android

I am creating an Android app which will allow users to upload video files to dropbox. I want the app to display a pop up message when the upload has completed which shows the user the URL to re-download their file. I'm using the Dropbox API V2 but I can't find anything relating to this. Looking online I can find mentions of using "share" but they seem to be related to an earlier version of the SDK.
Thanks in advance for any help

The standard way of getting a file's data from the Dropbox API is by directly downloading the data from a file download endpoint, and not by returning a URL the user can access. In the Dropbox API v2 Java SDK, you can use the downloadBuilder method to get a DownloadBuilder you can use to download the content.
If you do want to get a link, you can use createSharedLinkBuilder, but that's only really intended for sharing.

Maybe before get an answer for this question, you need to clarify what kind of solution you are seeking for.
There are three kinds of potential solutions for this task.
(1) Using the Acitivties or Dialog provided by Dropbox SDK, you use Intent to interact with them and get response in onActivityResult() call.
(2) Using the libraries provided by Dropbox SDK and construct UI using you own code, in this case you use the object models (like Entry, Session and WebOAuth2Session, etc) and Helper classes to access the data.
(3) Construct the object models and network access helpers on HTTP/JSON according the Dropbox API to achieve a full control on cloud document access. the download URL you are looking for must be in the JSON response text.
Hope it can help you to get an answer quickly.

Related

Dialogflow minimal viable product

I am trying to create the bare minimum of a chatbot with dialogflow in an Android app. Initially I do not need the bot to hook into things or have context and entities. I just want it to match questions with answers as good as it can.
I do not come from the web world so this https://dialogflow.com/docs/getting-started/basic-fulfillment-conversation confuses me. The final part of the tutorial is not finished and it leaves me hanging a bit.
As an Android dev I want the app to:
call a rest api with the user text
or possibly:
invoke an SDK and have a local pretrained agent and not involve the internet an all
You can download the Agent but that is just some json files. I found an Dialogflow.SDK but it seems to be related to speech. In the dialog flow console you can 'copy curl':
curl 'https://api.dialogflow.com/v1/query?v=20170712&query=Hi&lang=en&sessionId=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx' -H 'Authorization:Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'
I want to access the agent like that from multiple instances of an app.
Do you always need a 'fulfillment'?
The guide mentions creating folders on your local machine(in conjunction with fulfillment) are these only used to do a 'deploy' from your local machine to configure the web hook in the cloud? Or are they also used to deploy the entire Agent to the cloud project? (which i can't seem to find any instructions for, unless it's the same as for webhooks?)
gcloud beta functions deploy weatherWebhook --stage-bucket [BUCKET_NAME] --trigger-http
I have read questions with both tags DialogFlow and Android but most of them seem to involve Google Android Assistent which I have no interest in.
You do not need fulfillment. This is primarily for Dialogflow to take advanced actions or to use more complicated logic to handle the response.
You also cannot run Dialogflow processing on your device - all operations take place in the cloud. So you don't need to download the zip file unless you want to make a backup copy of your agent.
The REST interface you're looking for is the one you found. It handles more than speech - the /query endpoint can take a query parameter which contains "Natural language text to be processed."

Connect Android app to Play framework application

I'm developing my first android application, I'm trying to send video files I've recorded and saved in the applications External Cache Directory as well as other data like usernames, etc. I have a play application running on my server and have a mySQL DB running on my server.
I have experience with JDBC and oracle, but am unsure of how I should make the connection between the android app and the play app, I'm thinking I don't want the android app talking to the mySQL DB ever! that I'll send a JSON object from my android application to my play application, the play application will then take the JSON object parse it and update the DB with the user details and a pointer to the video file and also add the video file to the designated folder.
I'm unsure how to implement the connection on the the android app, do I create a new activity or maybe a fragment for the connection to the play app? a link to a simple tutorial taking a video file and sending it as a JSON object to a play application would really get me going.
I realize that might be a bit much to ask.
I was reading this post MultiPartEntity and thought it might be along the lines of how I would make the connection from the android app to the play app, but was unsure if it was using JSON(the comments suggest it does, but I can't see any JSON object creation)
is MultiPartEntity a good solution for my connection needs?
How do I deal with the JSON object when I receive it on the server end?
I'm thinking I'll have a route set up to deal with, but again a link to a similar example would be great.
Any help pointing me in the right direction is appreciated.
Your Play! application must have an endpoint to send data with post method (RestFul Web Service), Play! is Restful, just handle the uploaded file in your Action. In your Android Application, you can send data with Volley Library follow this link to do that How to multipart data using Android Volley
or your follow this tutorial with php web service but with what you want http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/

Android app to download Zipped JSon, best approach?

I have an Android app that is currently in the Google Play store. On my server, I generate Zip files containing JSON information. The server takes parameters from the Android app and generates an appropriate Zip file which the Android app downloads, unzips and processes.
I currently user he AndroidHttpClient method, but I suspect the HTTPUrlConnection would have been a better choice.
What would the approach be for using HTTPUrlConnection?
Will it handle situations where the Android app may make a call on a public Wifi which could cause a redirect? Is there any sample code that I could reference for doing this?
Thanks
JOhn
terramia.net/painter/HTTPClient/doc/urlcon_vs_httpclient.html to the pros and cons of httpclient and httpurlconection.
yes HTTPUrlConnection can be a better chocice.
why are you ziping at server and than downloading and than processing, please write some apis that sorer can respond on yours request and can send json data straight. it will save time complexity and space-complexity to some extent. just treat as my suggestion.

How to get the url of the website to which I upload a file?

Hi and thanks for any suggestion,
I have done my homework and tried to find an answer on SO and around, but so far I have been unable to find a solution.
I am trying to build some kind of FileManager to allow user to upload files on websites (any website, for example add an attachment to a mail in yahoo mail...)
Therefore my application registers a filter so that when the browser requests a file to upload the app opens up and provide the file to the requester (the web browser).
My question is:
is there a way for me to retrieve the url of the website to which the file is uploaded ?
I'm not sure I understood your question currently. my answer is relevant with the assumption: you want to have a direct download url to the file that been uploaded, and you wish to use this url in some point in the future to download that file...
I am afraid there is really no way getting such information.
there are many obstacles in the way of getting url to the file that been uploaded:
there is no any system broadcast / event that been sent in this scansion
even if the upload process was managed and initiated from you own application with you own WebView - the website you uploading to not necessarily provide you information of what is the url of the uploaded file. I know for sure that companies like yahoo not provide you this url.
if that's not enough - there is no necessarily such url at all!
the fact is that the server you uploading to is not necasserly doing anything with the uploaded file, or just not exposing him to public access with url.
from the reasons I mentioned, developing app as you which can be done only with servers providing their own API for upload files, and returns you the url as respond.
of-course each server has it own API (if at all) and you should speak with each one of the servers you'd like to support with it own language. sort of mission impossible if you want to support most of the big sites...
I had similar problem as to how can I get the URL where my file is uploaded. The answer is simple and lies in your Android code.
For uploading a file to some place, you need to know URL of the server/website.
So lets say you are uploading a file to
www.yoursite.com/appdatafolder/
For uploading to the file to the given address, you have to have a php script file sitting there, which will communicate with your android code for uploading the data.
Lets consider the address is:
www.yoursite.com/appdatafolder/upload.php
Now it depends on your code on how did you wrote your php script, in my case, I also send the name of the file to upload.php file, you can ignore it if you want or your script follows some other algo.
Lets say you want to upload importantfile.txt, so the url for uploading the file becomes
www.yoursite.com/appdatafolder/upload.php?filename="importantfile.txt"
The address you need to provide to the user in order to download the file becomes:
www.yoursite.com/appdatafolder/importantfile.txt
Now what you can do is save this address in a local database on your phone and use it whenever the user wants to download the file.
If you are afraid of securing the files which can be accessed/downloaded
www.yoursite.com/appdatafolder/
you can use htaccess. There are alot of other security mechanisms out there for securing data on the server from hacking. htaccess is simplest example.
So this is the easiest and hassel free way of solving your problem.
If you want, I can provide the php script I used.
Hope this helps.
If their is no secure layer on the web site, data sniffing by the app could be a kind of solution. you'll also probably need to deal with content encoding like gzip.
You'll need to filter the result's. It is easy to do: You just need to look at the application level in the OSI model.
Then you can apply a second filter if you know the ip address or the hostname of the concerned site.
There is even one more filter if you know the request method. But most it is get or post most of the time.
Have you looked at this question: Android file chooser? It has great example code as well as a link to a GitHub project (aFileChooser).

Is it possible to use Dropbox, Google Drive, Skydrive, etc. as a server space?

I'm creating an app that connects online to a server to collect information. To save money from renting server space from a big corp, I was wondering if any of these free services (Dropbox, Google Drive, Microsoft Skydrive, Amazon Cloud, etc.) could be potentially used as server space?
I pretty much want a "space" or "cloud" where people can connect to to collect data. Example: I have a weather app, and there is files on my server and I update the files according to the weather. I would like them to be able to open the app and connect to my server to gather the weather data saved on my server. It really won't be much digital space, so I didn't want to pay bookoo bucks when I could potentially use a free service like Dropbox.
You can't execute remote code on any of those services (that I'm aware of), but you could certainly save files to them. For example, you could write out text files (CSV? XML? JSON?) to those locations.
Take a look at the Dropbox SDK for details on how to integrate it to your iOS or Android project. It's pretty simple.
Here's a basic code sample for uploading a file:
NSString *localPath = [[NSBundle mainBundle] pathForResource:#"Info" ofType:#"plist"];
NSString *filename = #"Info.plist";
NSString *destDir = #"/";
[[self restClient] uploadFile:filename toPath:destDir withParentRev:nil fromPath:localPath];
I heard several times that it's working, but hadn't made my own experience yet.
Check out this post http://lifehacker.com/5528104/use-dropbox-to-share-and-host-your-web-site
As Axeva said you can't run your own scripts or sql. You have to write your own workaround.
I'm sure you can use Dropbox. But only if you want to download or upload some files. And I'm not sure if it's ideal. But there are other alternatives you may want to look at. Like you can use GoogleAppEngine if you want some processing to be done on server. Maybe Parse.com is another choice but not sure if it fits your needs.
Check out site44. It allows you to connect with dropbox and use a friendly URL (own domain or otherwise) for accessing the files.
I would recommend using something like Parse.com as your backend. Their free tier lets you store 1GB. Maybe not as much as Dropbox, but the API for Parse is great and made for storing/retrieving from mobile apps. You'll be up and running really fast. I haven't looked at Dropbox SDK though.
Dropbox works fine if all you want to do is using it as an FTP to put some JSON or XML files on.
Just be sure to put it in your dropbox's 'public' folder and requesting the public link.

Categories

Resources