Best Practice For Displaying Facebook Profile Pictures In an Android App - android

I want to have an android app that displays users' facebook profile pictures. I'm wondering what the bast practice is for this purpose. Should I make ImageView load pictures at runtime from facebook URI? or save the pictures to my own server and send them to the devices in bytes on demand? or cache them locally?
What is the "common" way of doing this?

Personally, I would cache them locally unless you intend to have hundreds of them.
It would make the app work offline and display the images a lot faster.
You would have to update them regularly though as a user's Facebook profile picture can change fairly often.

Related

Mobile Application Development using Android

I am developing an android application in which when a user logins through facebook his profile picture gets stored. Then the user is shown the profile pictures of his fb friends who have installed the app, one by one. First, one friend's pic is shown then on click of next button, next friend's pic is shown. This continues till all the friends images have been shown to the user or user has skipped the section.
First, I thought of storing all the images in my database and then retrieve them one by one as the user presses the next button. But doing so will render very slow performance as for every time an image has to be shown to the user I have to hit the db.
The alternative is to store images in my local drive and store every image's location in the db.
Please elaborate on how this could be achieved and the performance issues in this case considering a large user base?
Also suggest any other way of achieving the aim, if you may.
I am using WAMP for the purpose.
Thanks in advance.
The pictures are stored in the apps cache after they are downloaded.
When the user logs in to fb for the 1st time it will download the images.
2nd time it will get them from cache unless its a new image.
clear the cache when it gets to a certain MB limit and keep it small
I suggest using Google Volley library to get images from the net as when setup properly you can expire / clear images from the cache.
The are are other libraries for image loading and handling to consider such as Universal Image loader and Picasso but Volley can also be used for fetching Data from the Net.

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.

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

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.

Categories

Resources