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.
Related
I'm developing an android app using Firebase back-end. Everything works fine, I have no problem whatsoever. The only problem is that, the data loading speed. Because it's a cloud-based system, sometimes it takes 4-5 (or even longer) seconds to load a user profile picture or simply to pull username from the database to display user. Now, you might say, well we don't even know how your data structure is stored in the no-SQL table but really I can't go wrong with that. I just structured it in a way that it's just a simple one read query. Or is it normal? Maybe Firebase loads data with some delay.
How you as other developers, get over this loading time? For example, I have a user picture, where the pic should be loaded from the Firebase database, but till pic is loaded, the image-view is just staying as a black view.
All of this depends on several factors that you can check.
Internet speed
Programming type
The size of the files (you probably need a lot of time to load for a
high volume file)
And another solution is to store the information you've previously received into the phone's memory(cache).
I have a simple phototaking android app that allows the user to take a photo and save it. I allow the user to create multiple versions of the photo in the app - adding captions, filters, etc. After the user is finished, I upload the photo to Firebase storage. Here I upload a few files
The original raw bitmap that was taken using the camera
The finished bitmap with all edited captions and filters applied
The thumbnail of the the raw bitmap, and finally
The thumbnail of the finished image
The thumbnails and the full size images allow users to undertake future interactions with the app.
What would be the most efficient way to upload the images? Options that I know of are
Using 4 different upload tasks from the Android app. But this is taking a few seconds to finish all 4 uploads.
Using 2 upload tasks for the fullsize images and then using Firebase 'functions' to create the the thumbnails in the server. However, I would need to create the thumbnails locally in the app for display purposes before uploading, so it would mean creating the thumbnail in 2 places - app and the server. Also it would mean doing double error handling - one at the server side and the other on the app end.
Is there any other option?
Looking forward to whatever help I can get. As usual, feel free to ask for clarifications, via comments.
That depends on your scenario. If you are on "Spark" plan then using firebase functions too much might exceed your free quota of:
Invocation (125K/month)
GB-seconds (40K/month)
CPU-seconds (40K/month)
But if you can upgrade to "Flame" or "Blaze" then it won't be an issue and its the preferable way.
On the other hand, thumbnail file aren't too big that takes much time for uploading, unless you are on extremely slow connection, then uploading thumb files from app won't be an issue. You might not even notice the uploading time. It will be quick.
I am currently working in a project where I have to get huge number of images from Json(back end) and i have to display it to the user . There is no problem for this process if I do it online (with internet connectivity)
My question is, I have to display the same images even offline too, I know that Glide and Picasso can be used in this but I do not know the size of the cache that both have
Which one should i use now in order to make a good gallery in my application
the thing is, i will get lot of images from back end and i have to display it offline the first time when i sync i will have internet and i will store all the image URL in the local storage
Please guide me how to do this and tell me if there is any other way to perform this
Thank you
I've got a really simple (so far) Android app, which basically shows your friends on a Google Map. Think Latitude.
The friends are represented as avatar pins, the images of which are downloaded from the internet.
When a "friend" is added, i fetch the avatar in a background thread. I then don't need to download the avatar again (i'll probably check for updates during app start, but not too fussed about that right now). The actual images will most likely come from a social network (Facebook, Google, Twitter, Gravatar, etc)
Now, the map view will basically always be displayed, so the images are essentially always present. I will however be performing image manupilation, stacking, etc for these avatars.
Given the above information, here are my questions:
Where should i cache these images? Looking at the docs, i feel like a Disk Cache would be the best option?
Should i think about creating an image sprite? Remember, these images don't live in the APK/resources, they are dynamically fetched. Perhaps i could create a per-friend sprite with all the different image sizes i will require?
I also have access to the server which returns these images (right now they just return a URL) - so should i enable this server to instead do image processing/resizing etc based on my requirements, or simply download the original image and then perform the processing on my client application?
You can use lazy loading to dynamically download the users images from the URl and store it in cache. I believe this link would help you out in this :
https://github.com/thest1/LazyList
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.