Android App: Storing lots of images on a server - android

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

Related

Where to store files for my Android App, Storage and Performance-wise

I am building an android app which requires to have >300 images and ca. 100 audio files for an apk size of around 50mb (after webp compression and proguard).
It is not huge and I could probably live with that. But since I am planning to add other features the size will get bigger and bigger.
I am still interested though, since I'm quite new to android development, if there is a better way to store all this files, perhaps remotely and access them when required.
When the app starts I would have to load all the images into a list and once an element of the list is tapped I would need to open a separate activity and load the sound. So there is no upload from the App, just a resource gathering.
I do not know if it is more efficient this way or to store all the files locally.
Either way I would like to know what my options are. what are the pros and cons of a server (and if it would be a viable solution for me at all) and what is the advantage of storing them locally instead.
Please keep in mind that I working by myself and haven't got money to invest on premium servers or stuff like that.
FILE STORAGE will be best for you. Performance depends on the type and amount of data you are using. You do not need too much of data manipulation so go for file storage if privacy is not your concern for the data as it will be available for all the applications.
Use SQLite Database if the files needs to be protected from other applications.
Use File Storage(internal/external memory) if other applications can also access your files.
Avoid Fetching data from server using JSON parsing/Http requests it will make your app rely on the internet all the time. Unless you are using it to update your database or file storage.

how to create a server for large number of images and access them in android app

I'm developing an android app which involves a lot of images to be displayed. I cant store those images locally because the total size of images will be around 300 mb. So my question is, how do I store those images somewhere (like a server) and access them in the android app? I have looked through other questions but they talk about having a database and information about each user which I dont require.
I just want to store those images which will be of fixed size (user wont upload images) and display them in android using a http request.
Can I use google drive for doing this? I also read that google drive has some limit on the usage of public folders. So I dont think I can use that.
Any other way? like some free image hosting site or free server or something similar?
Or do I have to pay and use amazon web services or something similar?
I have zero knowledge about web services and servers.
actually where you want to use your app means you want use as personally or in business purpose .
If you use for business purpose then you take space on any server by paying some amount or you use just testing purpose then you use your local system as server by installing wamp.

How should I store profile photos database/server-side for an Android app?

I want users of my app to be able to view a gallery of profile photos on their phone but I'm not sure about the best way to store the gallery on the server? I'm using Postgres and a Java web service.
Should I store the images (or only a thumbnail) on the database or store only the paths and use a separate web server as I have read some people do? I wanted to make it as Android-based as possible so I wouldn't have to rely on having a web server to serve photos, but is there no way around it?
I have read about Postgres extensions to hold image files but I don't know if this is the most efficient way or not (I suspect it wouldn't be).
It really comes down to the size of the photos and how many of them you plan to be storing. Sometimes the database can be a viable option to store small thumbnail images, but generally this probably isn't the cheapest or most scalable solution but could avoid system complexity for a small project. For most projects I would go for file system/blob storage for images.
You should store both your full-size photos and thumbnails in the file system and store only paths in database. This would be more performance efficient.
You will probably need web server in order to protect who can see which photo.

How to build a simple offline form submission app?

I'm a Webdev beginner, have been learning some Python/PHP/Javascript and want to help a friend of mine with a project.
She's conducting a large scale survey of old houses/windows, and fills in forms (similar to Google Forms). However, she doesnt always have 3G coverage on her phone, so she wants some way of uploading the data when she gets online, and she wants to be able to upload photos and attach these to the forms.
I've found a javascript-library which makes use of html5 localstorage, but I havent understood if localstorage also accepts file uploads? Also, when you have submitted one form you would need internet access to open up the form again to submit another form.
Are there libraries or projects around that would help me with some of this, so I dont have to reinvent the wheel?
This is going to be very difficult to do with a web app. Your going to have to rely on something like AJAX to send the data and if it times out store in local storage and keep retrying every few minutes, because a web app has no access to anything like checking the wifi status etc.
Also that there is a limit to the size you can use in html5 local storage:
What is the max size of localStorage values?
, this is not going to work if you want to hold onto photos.
This would require a native or minimum a hybrid app (like phonegap) to store the data on the actual device in a file or SQLite database. This way you can store what you like, have access to the status of the internet connection and even have prompts to appear on the screen (when the app is in the background) to remind her that there are still some that need to be uploaded.
It will be much more reliable and stable this way
You can create an app which stores the data (form) in the Local DB (ie SQLite) of the App.
Once she is online (mostly wifi) she can start uploading the data.

Best Database design option for Android application with huge data

I am new to Android Application Development and a new member at stackoverflow. I am currently trying to design a recipe application. I have decided upon the features of the app and the scope it will cover. The scope is very vast for me in terms of covering all the recipes from all over the world. I am to deal with a lot of data in this process.
I am currently trying to figure a good and efficient way of handling the data in my app. So far, as per what I have read in different forums, I believe that I have two options in terms of a database choice : 1) SQLite 2) Database on remote server (MySql/Postgre)
Following are some of the thoughts that have been going on in my mind when it comes to taking a decision between the two :
1) SQLite : This could be a good option but would be slow as it would need to access the file system. I could eliminate the slowness by performing DB data fetch tasks in the AsyncTask. But then there could be a limitation of the storage on different phones. Also I believe using SQLite would be easier as compared to using a remote DB.
2) Remote Database : The issue that I can see here is the slowness with multiple DB requests coming at the same time. Can I use threads here in some way to queue multiple requests and handle them one by one ? Is there an efficient way to do this.
Also I have one more question in terms of the formatting of my data once I pull it out from the above DB's. Is there a way I could preserve the formatting of my data ?
I would be more than thankful if someone could share their knowledgeable and expert comments on the above scenario. Also this is not a homework for me and I am not looking for any ready made code solutions. I am just looking for hints/suggestions that would help me clear my thoughts and help me take a decision. I have been looking for this for sometime now but was not able to find concrete information. I hope I will get some good advice here from the experienced people who might have encountered similar situation.
Thanks for reading this long post.
What about combining both approaches?
A local SQLite database that has the least recently used receipes so you don't need network all the time. Network is way slower than accessing the filesystem.
Some remote database accessed via some HTTP interface where you can read / write the whole database. And if you want users to be able to add receipes for other users to see you'll need an external database anyways.
SQLite : This could be a good option but would be slow as it would need to access the file system.
Accessing a local database is pretty fast, 5ms or so if it's just a simple read only query on a small database.
But then there could be a limitation of the storage on different phones
Depends on your definition of huge database. It is okay if it is only 2MB which would be enough to store lots of text-only receipes.
Also I believe using SQLite would be easier as compared to using a remote DB.
Yes, Android has a nice built-in SQLite API but no remote database API. And you don't need to setup a database server & interface.
The issue that I can see here is the slowness with multiple DB requests coming at the same time.
A decent database server can handle thousands of requests. Depends on your server hardware & software. https://dba.stackexchange.com/ should have more info on that. Required performance depends on how much users you have / expect.
I'd suggest a simple REST interface to your database since it's pretty lightweight but does not expose your database directly to the web. There are tons of tutorials and books about creating such interfaces to databases. There are even hosted database services like nextDb that do most of the work for you.
Is there a way I could preserve the formatting of my data ?
You could store HTML formatted data in your database and display it in a WebView or a TextView (via Html#fromHtml()) - both can display formatted text.
Databases don't care what type of text you store, for transfer over the internets you may need to encode the text so it does not interfere with the transport formatting (XML, JSON, ...).
A simple way is to integrate Parse into your app. They have a nice framework that easily integrates into iOS and Android. Their plan is freemium, so you'll be able to use up to 1 million API request for no charge, and then its 7 cents for every request after that.
You'll have 1gb to store all your data sets / images, etc.
I don't use parse for everything, but I HIGHLY recommended it for large data schemes because they do all the scaling for you. Check out the API, I think it would be worth your time.
I just started to work on a few of my own projects, and I'm using Parse again. I have to say it's improved a lot over the last 6-8 months. Especially with the Twitter and Facebook integration.
The key issue here is the size of the data - any significant database of recipes would be too large to store on the phone imho,thus you seem stuck with the remote database solution.
As opposed to trying access the remote database from android I suggest you use a a go between web application that will process requests from the application and return JSON objects that you need.
It totally depends on your software requirements. If you need to deal with a small amount of data then you may choose SQLite, but for a huge amount to data better use a remote DB.
SQLite: It works fine with little amount of data & I experienced it response time is good.
Remote DB: I think you may use small server side app to submit the data to your client app. It will solve/reduce your thread related issues/complexities.

Categories

Resources