Can someone please clarify this for me. I am reading the developer page about the blobstore at https://developers.google.com/appengine/docs/java/blobstore/overview. I can't seem to wrap my head around the process of saving and retrieving blobs? It sounds like
android app would directly send an image to the blobstore
after saving the image, the blobstore would then return a blobkey to my backend for me to put in the datastore
Is that the process? Maybe it's because I have had a long day, but I just can't see it. If someone has an example they don't mind sharing, please post it. I just need to save images from android in the blobstore and then be able to retrieve them with blobkey or otherwise.
I have already look at
Upload to Appengine Blobstore in Android
Using Google BlobStore with an Android application
Android Interaction with Google App Engine Blobstore Service
What is the syntax to get a Blobstore upload url from Android?
For the life of me, I don't know why they are not doing it for me.
I suppose some questions are:
How does android know where to send the blob to? I mean, does Google distinguish between my instances of the blobstore versus other people's instances, similar to how it distinguishes my instances of the datastore? In other words could I go to app engine Applications Overview and see all the blobs that belong to my app the way I could in the datastore? I suppose a complete, working piece of code could help me see these answers.
Part of my problem could be that I have never used servlet. I am presently using Google Cloud Endpoint for my api.
Actually there are two ways to upload to blobstore:
Using direct upload handler:
Server gets a unique one-time secret upload url via createUploadUrl(..) and sends this url to client.
Client uses multipart/form-data POST to upload data to this url.
The upside is that you can upload large files (>32mb).
Using blobstore FileService API which is deprecated and should not be used any more:
You create you own POST upload handler where client uploads data.
You use FileService API so save data to blobstore.
The downside is that you can upload max 32mb of data (generic GAE request limit).
The upside is that you have access to data so you can edit contents if needed.
Your description of the process is correct. The only step you miss is the first: the server side calls blobstoreService.createUploadUrl(redirecturl) to generate the URL to upload to. Then the handler at redirecturl will save the blob key to the datastore.
Related
I'm really new to Firebase and am studying how to implement it right now. I was thinking that it has functions similar to Parse where a ParseFile object can be created that holds the file and then has functions to upload it something like the following :
ParseFile parseFile = new ParseFile(file);
parseFile.saveInBackground();
If you have suggestions and/or working solutions do post them as they will be exceptionally useful.
I am also studying about RetroFit as it has a great way of sending MultiPartPost requests and if ever could be tied up with Firebase I just can't find the connection yet.
Thanks in advance!
Firebase Hosting is a service for hosting static assets, typically the HTML/CSS/images of a web site. You cannot programmatically add files to Firebase Hosting.
The Firebase Database allows you to store JSON data. While binary data is not a type that is supported in JSON, it is possible to encode the binary data in say base64 and thus store the image in a (large) string. See Can I store image files in firebase using Java API? Note that while this is possible, it is not recommended for anything but small images or as a curiosity to see that it can be done.
Your best option is typically to store the images on a 3rd party image storage service.
I am making mobile application . I have used Azure mobile service as the backend services for to build mobile application . In mobile app i have to upload images to azure cloud storage . I can do by two method .
Uploading file from the client application
uploding by sending byte array or base64 string of file to server
and server will uplod that file to them
I think first method is good as it is directly going to upload file instead of going to server and pushing again to azure storage .
I don't know which approch is good . Any help is appriciated
As David mentioned, the question is a bit broad and not related to CDN, but within the scope of Azure Mobile Services, I would recommend option #1, as that offers a few benefits, including (but not limited to):
Minimized load on your Mobile Service, potentially avoiding the need to scale the service to keep up with file management
Ability to use the storage APIs designed to handle blob management from the client and avoid having to implement and maintain similar APIs as part of your service (including support to resume uploads/download and other nice features for mobile apps)
Ability to (more easily) use the different geographic locations offered by Azure Storage to have clients upload and download files using the nearest location.
And the list goes on...
The recommendation is still to expose an API from your service to allow clients to request a SAS token in order to provide authenticated access to storage. This approach is similar to what is used by the Mobile Apps File Management SDK.
I hope this helps!
You can use a third party service like Filestack that handles the uploading & storing files, and the CDN delivery.
You can upload files directly to Azure with the pick and store method:
filepicker.pickAndStore(
{
mimetype:"image/*",
multiple: true
},
{
location:"azure"
},
function(Blobs){
console.log(JSON.stringify(Blobs));
},
function(error){
// console.log(JSON.stringify(error)); - print errors to console
},
function(progress){
console.log(JSON.stringify(progress));
}
);
And then every file uploaded generates a CDN url that you can use to deliver the image in your application. Not sure if you've looked into what CDN you want to use yet, but Filestack partners with Fastly so you have all of their features, which is one of the best.
I use Cloudinary is a image back-end for web or mobile development, It's really easy upload images to a CDN.
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/
I have some questions about developing a Android application which shall be able to communicate with a NodeJS server.
The Android application gathers some data and saves everything in a .csv file.
This file now needs to be uploaded to a NodeJS server. The NodeJS server should save the file as well as storing the content in a MongoDB.
My question now is how I should implement the communication between the Android device and the server.
I know how to upload a single file to a NodeJS server using a HttpURLConnection with a DataOutputStream.
But I need more than just uploading the file because I need a unique identification of each Android device.
I thought about using the (encrypted) Google account E-Mail address of the user to distinguish the devices. I am not interested in knowing who uploads which data but I need to store the data for each device separately.
The problem is that I don't know how to communicate between the device and the server.
If I upload a file via HttpURLConnection and DataOutptStream it seems that I can only upload the file without any additional information like the unique key for the device.
I also thought about uploading the file via sockets. But I am not sure how to handle huge file sizes (5 MB or more).
I am not looking for code fragments. I rather need some hints to the right direction. Hopefully my problem was stated clearly and someone can help me with this.
Using a HttpUrlConnection on the Android side, and a RESTful server on the Node side would be a straightforward option.
You can embed information into the URL in a RESTful way:
pathParam: www.address.com/api/save/{clientId}/data
queryParam: www.address.com/api/save/data?c={clientID}
each uniquely identifying the client. This can be whatever scheme you choose. You will have to build the HttpUrlConnection each time as the URI is unique, and important!
The server side can then route the URL however you see fit. Node has a number of packages to aid in that (Express, Restify, etc.). Basically you'll grab the body of the request to store into your DB, but the other parameters are available too so it's all a unique and separated transaction.
Edit: The package you use for RESTful handling can stream large files for you as well. Processing of the request can really begin once the data is fully uploaded to the server.
Using a socket would be nearly just as easy. The most difficult part will be 'making your own protocol' which in reality could be very simple.
Upload 1 file at at time by sending data to the socket like this:
54::{filename:'myfilename.txt',length:13023,hash:'ss23vd'}xxxxxxxxxxx...
54= length of the JSON txt
:: = the delimiter between the length and the JSON
{JSON} = additional data you need
xxx... = 13023 bytes of data
Then once all the data is sent you can disconnect... OR if you need to send another file, you know where the next set of data should be.
And since node.js is javascript you already have wonderful JSON support to parse the JSON for you.
Would I suggest using a socket? Probably not. Because if you ever have to upload additional files at the same time, HTTP and node.js HTTP modules might do a better job. But if you can guarantee nothing will ever change, then sure, why not... But that's a bad attitude to have towards development.
I'm working on a simple multimedia messaging app for Android, and I was trying to use Google AppEngine's BlobStore as my cloud storage for the various image, video, and audio files that will be transferred. However, all of the examples and such that I've seen for uploading to blobstore assume that I'm doing it via an HTTP form, and so I'm kind of at a loss as to what to do.
I've seen several people asking the same question, but none of them seem to ever get a satisfactory answer. Can I or should I use AppEngine's blobstore in this way, and if so how do I go about doing it?
Thanks, SO.
You could go with something like this:
1. On Google App Engine, create a Web Handler that calling blobstore.create_upload_url() returns an action_POST_URL
2. On Android, post the image to the action_POST_URL using HttpClient and MultipartEntity.
for Java
BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();
String action_POST_URL= blobstoreService.createUploadUrl(redirect_URL);