I have a set of images that are being periodically uploaded to an Amazon S3 bucket. I need to display these images in my app. As opposed to manually writing code to handle aspects like multi-threaded downloads and caching I wanted to use Fresco to do this as I'm already using it for other tasks within my app. This answer mentions that it's possible to do this by writing a custom content provider which wraps a transfer observer. However, the specifics of doing this don't seem to be clear.
A bunch of tutorials about writing a custom content provider available. For instance: https://developer.android.com/guide/topics/providers/content-provider-creating.
Another option might be to implement a custom network fetcher which handles special URIs and queries S3 underneath: https://frescolib.org/docs/using-other-network-layers.html
Related
My app uses images from a URL and I want to reduce resources usage for both server and client.
I wonder if the Android SDK already offers something for this (if there's some standard way to do it) or I just have to figure it out.
What I have in mind is:
download images on local storage (external or internal) when accessing content (lazy loading, progress bar) and keeping them there for next use
update images (download and replace) if changed on server (keep checksum in a database that is queried when the application is started)
in order to avoid excessive local disk usage (they are quite big), delete images for content that has not been accessed for N days. This is done while loading the app or in a background asynchronous service
Should I do this step by step or is there something that already takes care of it. Are there libraries to do this properly?
I think Picasso library is best for this, it has many capabilities and is really easy to use, its features include smooth image caching (the features you need), image processing and Async downloading from URL too. It has so many useful features.
Here is its url link
http://square.github.io/picasso/
I need a way to show several ( maybe 20-30 ) images on screen on an Android application i'm working on.
Considerations:
My images are stored in AWS S3.
The list that displays these images is implemented using RecyclerView.
After some research, i've decided to use Fresco to show and cache these images, but now i realize that i need a Uri from said S3 images.
How can i accomplish this?
Maybe using the newer TransferObserver.download(); and just display the images is better? But again, caching and recycling gets in the way.
Is there something super obvious im missing?
I've tried to use the link given at the S3 GUI but i get access denied, of course. I haven't made these images public because of security reasons.
Fresco does support content provider URIs. So you could write your own content provider that in turn wraps an Amazon TransferObserver.
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
I'm new to android development and i was looking for simplest explanation for using the SimpleCursorAdapter class with a cursorloader for pulling out Video Thumbnails and details from my android device. I'm doing a mini video file browser in my app which i am using a gridView, a Fragment, and some content providers pointing to some external URI. Any form of help will be very much appreciated
Take a look at the Android training guides.
The guide Loading Data in the Background shows you how to set up a CursorLoader and use it to get data from a content provider.
The guide Sending Operations to Multiple Threads shows you how to do work on a background thread. It includes sample code for downloading, caching, decoding, and displaying images, which is pretty close to what you're doing.
The second guide makes extensive use of Fragments.
I'm not sure what you mean by a content provider that "points to some external URI". Content providers can be backed by any type of data, but they're best suited to structured data that exists on the device.
For an example of downloading images in the background, take a look at here.
I used this in a ListView and it works nicely to download images on another thread as well as managing a cache of the images. Easy callbacks are used and I implemented a view switcher in my list to allow an easy transition from the placeholder image to the real, downloaded image.
I am managing a bunch of PDF files in an android application maintaining a list of records in a SQLite database as well as storing the pdf files on the external storage.
Now I would like to present a thumbnail of the first page of the pdf in my list view as part of each cell representing a pdf.
I am aware of libraries like iText, fop.. on the JavaSE side that can render a PDF but I would rather not delve into embedding a large library like that. On a similar approach I would also rather not embed a native PDF viewer like droidreader, apv or vudroid.
Otherwise I could of course also get it rendered on a server via some webservice but that is a lot of headache as well.
I am already using intents to get the pdf's displayed for the user so I was thinking it would be great if I could get a thumbnail via a intent call as a result somehow. However I found nothing on the web (e.g. on openintents) that indicates something like that exists ..
So I am a bit at a loss on what to do? What do you think is the best approach to get these thumbnails into my app? Are there any public intents available? Or did I just totally miss something and the SDK provides features for that already (it should imho but currently does not)?
You are going to get a lot faster resopnse rasterizing the PDFs on the server and there are lots of libraries to do this in C, Java, Php.