How would you approach this problem:
My app should download different packages of pictures (containing up to 300 pngs, each about 20 kb) and store the pictures on the phone, so i can display them.
I want to upload the pictures somewhere online, so I can change them every time and the user can enjoy the newest pictures. (I upload the pictures not with the app)
I read that storing them in a sqlite db isn't the best option.
At the moment I am storing the pictures in the app, but then I don't know how I can upload and replace pictures on all apps immediately without the need of updating the whole app.
I don't need code or stuff, so don't waste your precious time on that, just some general hints where and how you would store the pictures online, and how android can download the pictures easily.
Take a look at the Glide or Picasso libraries. Those are super easy to use for thread-safe downloading of images.
Personally, I just fetch/store the images on imgur.
If you want to upload a dedicated databse, you'll have to set one up. Some common ones are Amazon, Google, etc. There are tons.
Have a look at this answer. In this answer Picasso library is used to handle image download. Picasso gets rid of a lot of coding and testing to handle image download.
In a project that I am working on, we use Amazon S3 to store our pictures, it's very reliable and is one of the goto solutions right now.
From what I heard Snapchat and some other big firms use S3 to store their picture!
It's also very cheap, plus I believe they have free hosting to a certain degree.
This is their API guide for android.
We use a service called File Picker to handle upload and download from amazonS3, it reduces a lot of work, but I don't think it's a free service.
You can use Picasso for downloading images from network in Android. For storing images Amazon S3 or Google cloud storage can be your options.
Not sure if downloading packages is better than downloading individual pictures (archiving won't save you much space).
As for your question, you can make some kind of API you will query from your app, even a flat file hosted somewhere with changing content would work. Your app could check it periodically for the new address to download pictures from (assuming it will change).
another way is using push messages - sending out a push through GCM that your apps will receive that will notify them about new content available. It would even work when the app is closed.
Related
I am developing an app which is a graphical book. Every week, a new chapter is being released and the app will be updated. There are basically images that are going to be shown to the user as slides. The user can subscribe and all chapters will be visible to the user (the image sources are offline and embedded inside the APK file). The images are not saved into the internal SD card (like they are not shown in the phone gallery after installing the app).
I am afraid that it is not a safe way to show the content to the users. What if someone just extracts all the images? I am thinking of the solutions below. Please give me the best option to keep my image files secured.
Obfuscating the app (I'm not sure if this works in this case. I know obfuscating helps to change the codes but I'm not sure if it helps to encrypt the images)
Using an online server and let subscribed users download the images (I think this way it might be saved inside the external storage. Anyway after the download the images must be available offline)
Should I encrypt the images by an encryption method?
Let's explore your options one by one
If you obfuscate the app, it can be deobfuscated
If you use an online server, the images will be downloaded, you can manage to store the downloaded images into the memory instead of the disk and then show directly from memory.
If you encrypt the images, you need to have some decryption method/key implemented in the app, which can be retrieved and bingo,
the user can have decrypted images.
So if downloading the images from an online service will not break your business requirement, then go ahead with that.
Remember that, in any of the cases, if one is determined to save the images, he/she can.
You may need to have multiple methods in place to make it harder for those, seeking to save it.
I am trying to pull videos from firebase storage and put them into a slideshow on my Android app but the videos take so long to load. Does anyone have any alternatives or ways to speed up the data download?
You can store your files in the Regional Storage, such as us-east1.
Please refer to https://cloud.google.com/storage/docs/bucket-locations and change your bucket's region to most closest place to you.
One thing you can do is split your video in smaller chunks when you are uploading
then download chunks one by one as slideshow plays.
It is a good idea because by this way you or your user don't have to wait for whole file. you can start playing videos as soon as your first chunk is available and then continue downloading next one's in background.
When you chunk video files, you reduce the risk of timeouts. If a small chunk fails to download for whatever reason, you can automatically retry only that chunk, instead of having to restart the entire download.
and yes when firebase is downloading it will do chucking but it'll be random and not much useful to you now because firebase'll do it for download and it'll signal you when file is fully downloaded to play.
Every streaming service does this. even though multithread downloaders also do the same.
you can google to find optimal chunk size and more about it.
I just googled and it looks good.
https://www.limelight.com/blog/multiple-solutions-for-low-latency-live-video-streaming/
I am in the middle of writing an android app while teaching myself java all at the same time and my project is a bit cumbersome for a first time app. NOTE:
I am not a newbie to programming, I know several languages with the exception of java and writing code for mobile devices. With this all said and done, I don't want to have to force my users to have to update the app every time there is a new image.
Is there a way, I am assuming there is, to check on startup if all the images are up to date and if not download the new ones to the drawable resource folder for use in the app?
I have searched and found ways to remotely fetch items but nothing specifically for updating app images. For example: Splash Screen Image, or background image etc.
Thanks for your time and apologize if this does not conform to stackoverflow form of asking a question.
Shawn Mulligan
Based on my knowledges, there is no way to do why you're asking for. Resources are static contents and there no way to modify or update them programatically.
To achieve a kind of feature that you describe, it should be through a distant server, eventually with a local cache of your images on disc, associate to a download date.
But you won't be able to use them in the exact same way that you can use drawable resources.
Also depends of what you really mean by "if images are up to date".
i'm actually adding a music player in my android app. It will contains 8 albums, 12songs in each one. So i'm thinking about the best way to do this. Should i store the mp3 songs in the app, which will make there lecture faster and won't need access to internet. Or maybe it's too much heavy and calling mp3 url would be a better idea?
Thank you
There are a few things to consider when evaluating your options.
If you ship the songs together with the app, you will greatly increase it's size. Most probably you will go over the 50 Mb limit, and you will have to implement APK expansion files, which are downloaded when the app is first started. Implementing this is not very hard, but it can take some time.
If you implement a custom download for the songs, you can optionally provide better control over what is downloaded, optimizing bandwidth usage, download times, etc. Still, it would be more difficult to implement then the standard APK expansions, and you will have to deal with a lot of additional download logic - pausing / resuming, dealing with insufficient storage space, etc.
My advice is to go with an APK expansion, which is downloaded when the app is first started and will manage all the download complexity out of the box. If you need a more fine grained download - go custom.
Good luck.
I am attempting to build an android app and in that app I have a list view, which I would like to have thumbnail images in. The images are stored on a server, and they are all in the same folder (e.g. http://myserverlocation.com/images/dining/myImage1.jpg,myImage2.jpg, etc). What I want to know, is if there is an easy way to get all the images (approx 25) using ONE http request, or connection. What I want to avoid is making 25 http requests, one for each image, to get all the thumbnails. I'm familiar with AsyncTask, and BitMap, but I haven't seen anything on this site (or the internet) that talks about getting multiple images with one call. I was hoping someone here would have an answer for me, as to whether or not this is possible. I'm open to any suggestions on how I might be able to accomplish this task, without using all the phones resources and/or memory.
Thank you!
If you are controlling the web service, I would highly recommended storing a zip file and retrieving that. I believe that Android likes to play with bzip, but that may be wrong.
Either way, I remember reading on the Android Dev site or watching a Google IO talk and they suggested to zip it before you ship it.