Android data handling - android

I'm creating an app where users can upload data and pictures, which are stored in my server, and those data can be accessed by other users.
How do I send/receive data and pics to/from my server
I am planning to provide camera in the app, if so how do I manage the size of pics for easy accessing both ways

you should be more specific, about the technology you plan to use for the server side. Whatever you choose, Try with JSON for easy protocol on your data transfer from server to device, search for what frame work to use for the android part
here an example with ,
REST

Android ION library can help with sending images in both directions.
If you plan to use Camera Intent, you will have no control over the images you get back, so you will need to resize them on your side. If you use the Camera API (a.k.a. custom camera) in your app, you can choose any picture size supported by your device.

Related

Android : How the images can be saved and retrieved efficiently from server side?

I'm creating a native android application which loads images of users. (An image of the user that is shown as in WhatsApp, messenger, etc). I need to update the image once a user changes it.
One approach I'm aware of is saving images on a separate server and saving the link to the image in the database. While loading, fetch the image from the specified url and cache it.
Another is saving the image as blob (don't think it's efficient) and cache it.
What are the approaches that I have to save images and retrieve them efficiently?
I'm using spring boot and couchbase as backend
If you save a link:
Often you can store the image on a cloud server that's less expensive
You have to retrieve the link, then build the code to retrieve the image
Checking for updates is at least slightly more complicated
If you use Couchbase Lite:
New images can propagate easily to the client
Storage is efficient
Blobs are stored as separate files
The associated document overhead is tiny
Simple to implement

Best solution for Push Notifications

I need to implement something that will allow me to pass a JSON from a .Net server app to mobile device, and from the mobile device back to .Net.
The JSON could be anywhere up to about 400KB in size so I need to find a solution that will ensure that the JSON can be compressed to a suitable size.
I don't have much experience in this area so was hoping someone would have some recommendations.
I was looking at PubNub but I can't see any way of getting a 400KB JSON compressed in a way that it could be passed to their channels.
Well GCMseems such an obvious choice. Regardless of what you choose you don't need to pass 400kb of data (compressed or uncompressed) the usual practice is to pass a link to the data. Once the device receives a push notification it can look at the link and retrieve the full dataset if needed.
GCM can be used with .NET or any other programming language of your choice and it's supported on both ios and android (I am beginning to sound like an advert for google)

Image processing in Google App Engine

I am trying to create an application server that does the following.
Get images from a user phone (once every 10 minutes).
Compare the new image with a reference image (pixel by pixel)
I managed to store an image using the Blobstore APIs. But I am only allowed to retrieve and display this image in a webpage(using the Blobkey). I wish to get the pixel data and implement an image difference algorithm on the server.
Is there a way this can be accomplished ? And is there a way to accomplish this without the use of blobs or database storage ? I can basically discard the new image once the comparison is done. I just need to store the reference image.
You can load any file from the Blobstore if you know its key, and manipulate it anyway you want. For images it is as simple as:
Image referenceImage = ImagesServiceFactory.makeImageFromBlob(blobKey);
Take a look at Images API, which is an App Engine service.

Android App: Storing lots of images on a server

I'm in the process of developing an Android (just Android for now, maybe iOS later) app which relies heavily on taking pictures, storing those pictures on a server somewhere, and being able to retrieve any picture whenever a user needs it which will be very often.
The problem I'm fearing before even getting that far into the coding is how I'm going to cost-effectively store all of these pictures on a server. If the app were a success there could potentially be hundreds of gigabytes of images being stored and many users requesting 1 picture at a time each.
So I'm wondering what approach I should take. It seems to me my options are either use a web host or use some cloud computing/storage service. I think hosts might be out of the question because I don't think a host would support that amount of storage. That leaves me with cloud computing.
I've looked into GAE and AWS. AWS seems like the best approach because I could use S3 to store my images and then RDS to store information for each user in a relational database. I know next to nothing about server stuff, so I don't really know what all I should use in the AWS setup. I know I need S3 and I know I need a relational database, that's all. So what features exactly would I need?
Or does anyone know a better approach all together I should take?
Also, in Android is compressing images an option so they won't take up as much space on the server? Is the quality affected a lot?
I have used AWS for storing images uploaded from Android devices. What I did was to upload the images directly to s3 using AWS Android SDK and then keep records in database of the keys/paths where each user uploaded his images.
This approach has the advantage that you don't use your server (for example EC2) for the image uploading, leaving you server available for other tasks.
If you are going to use AWS I think you will need at least the following services:
S3: for storing the images.
EC2: For deploying your server code.
RDS: For your database (assuming you are using a relational database)
There are a lot of tutorials out there about uploading files to s3.
http://aws.amazon.com/articles/3002109349624271
You can estimate costs using Amazon's calculator

Upload image data to web server from android camera

Here's what I'm trying to accomplish:
After user takes a picture with the android camera, I want to save the image onto my Ruby on Rails web application (like PicPlz or Instagram)
Approach 1: After user takes the picture, convert the byte array and save as .jpeg on the phone. Then upload the image file onto the server through a post request (Link here)
Approach 2: After user takes the picture, post the byte array data directly to my web application's web service, and then have the web application convert the byte array into an image file and save it onto the server
Question: Which approach is faster and more efficient?
I'm also open to suggestions for other approaches.
Thanks for your time and help :)
The answer is inexplicably the server, especially if you can get Image Magick installed on the box and convert the stream from the command line. I use PhP, but to my understanding running commands from Ruby is very similar and easy.
The phone... nine times out of ten is going to be running a whole lot of background apps and you will never be able to rely on it to do anything quickly. People install garbage on their phones and never clean it up just like they do there PC's and Laptops.
Approach 2 is better.
There is another approach that u can take.
- store the byte array into a temp file before u start sending it to the server.
- This makes sure that u don't lose the data even if there's a problem with the connection.
- Once the upload is complete, ur application can erase the temp file.
- One more advantage of this approach is that u can make sure that the user can make use of ur application, even when they are not connected to the internet.
- Once the user is connected u could ask them, n then start uploading to the server.

Categories

Resources