Android App Viewing Images Uploaded on Cloud Storage - android

I have a catalog Android App that I am building to showcase different catalogs from different local stores. The Catalogues are basically pages in Image(JPG) format. I would like each store to have its own activity that launches a catalog.
From my research, I can achieve this by creating a storage reference to a storage bucket that holds these images on google cloud storage. I have created one storage bucket that is holding about 8 images of a catalog. I am not sure how to implement this connection to my app.
What would be the best way to go about this? Should I create a tabbed activity for the images to be swiped through and if so, how is this created and referenced to the images from the android studio?
Any help or resource on this would be highly appreciated.
I have already connected the App to firebase which is working fine.
I have the activity_main.xml layout file with all stores and upon clicking on a store the idea is to launch the catalog images for that particular store.
Please help!

You can see Firebase storage quickstart which can give you an idea on how to setup your app. For displaying images, it would be easier if you use Firebase UI, here's a link to the related documentation.
EDIT:
By the way, you are in the right track of setting different references to your buckets.

Related

Where can I store private images for my app (outside of internal storage)?

Is there a place where I can store and manage my own images outside of internal storage? I don't want other apps to be able to see or access these images. Should I use external storage? Does such a place exist in the new MediaStore? It's fine if they're deleted when the app is deleted.
This solution needs to support API 21 or higher.
I know there are a lot of questions like this, but they're 10+ years old and a lot has changed since then.
Use case / background
I have an app where all data is stored locally on the device (no external servers).
Users can choose custom background images for journal entries. A user could choose to use a different image for each journal entry they create. They can create as many journal entries as they want. They may revisit those journal entries. So, I need to store an unknown amount of images for the lifetime of the app. I've been saving a copy of the images the user picks from the gallery in my local app storage via context.filesDir.
I noticed a crash Fatal Exception: android.database.sqlite.SQLiteDiskIOException disk I/O error (code 4874 SQLITE_IOERR_SHMSIZE) and after googling, I found This error may indicate that the underlying filesystem volume is out of space.
My concern is that my app is running out of internal storage space because of the user images I'm storing.
Where should I be storing these images? I originally chose internal storage because I wanted my users' images to be reasonably private (since I don't know if they're storing sensitive images or not). I also wanted to make sure the images would always be available even if the source image (chosen from user's media) is deleted. However, I hadn't considered the limits imposed on internal storage. Silly me!
Darshil's answer is correct. Using the recommended Storage Access Framework for your use case, you should use getFilesDir() which will return your app's internal storage, which is private to your app.
Where should I be storing these images?
problem is due to limit of resource which is out of our control. However if you really want to store all the images, you can take some approaches:
1. Online: Use some cloud servers for storing user data. This might cost you a lot.
2. Offline: Tell user that you have only the limited amount of storage and storing more images will require to delete some older ones.
3. Both: Store in device. When internal storage is running low, tell user to buy some type of premium subscription to store unlimited cloud photos.
Android does not provide a place for you to store private photos (can't be accessed by user or other apps) outside of app's internal storage. I know you can contradict me by saying that one can store them in external storage by using getExternalStoragePublicDirectory() but the problem is that it is a shared directory accessible to users and other apps and remains when the app is deleted.
So I suggest you to use getFilesDir() as the directory returned by it is hidden from users and is deleted when the app is deleted. And also implement a image compressing tool in your app which automatically compresses images when uploaded by the user and then save it to internal storage. This won't solve the problem completely but I guess it's a start.
I would recommend checking out AWS Amplify which allows you to integrate your application with AWS services. For what you have described, you could use amplify to give your app the ability to authenticate users and set up cloud storage on AWS S3 which you can configure to only allow users to access and edit files that they have uploaded. One nice thing about AWS Amplify and AWS S3 cloud storage is that there is a free tier which allows you to develop your application for little to no cost. Depending on the amount of data that you will be uploading, it may be quite a while before you surpass the free tier limits.
A guide like this one may help you learn more.
I am not sure if I fully understand your question, but writing a quick tip.
try cloud services to store your images like AWS s3, cloudinary. Cloudinary is much cheaper if you want to try like 25gb/month free.
With limited storage space appearing to be the root cause, I recommend intentionally using the UI to encourage users to use existing images over new images. (This can work in addition to the technical options provided in other answers)
For example, present the user with a list of available background images and a link to add a new image. In this case, using an existing image is 1 click with a preview, where getting a new image requires opening a new view and searching for the new image.
Using the UI in this way doesn't directly get you more space, but it can help you to more efficiently use the space you have by guiding users to use existing images. It also gives you a place to warn about (or limit) adding more images when there is not more space available.
*If you still must have more storage on the device outside of the app, you could try using the public space with encryption for "privacy".

How to store images in android?

I am trying to develop an app on android using xamarin.
i just wanted to know where to store images.I mean which way is better, should i store images in DB or in a separate folder.
which one is better?
I was talking about images of products. for example:- i downloaded the ebay app today. app is very small in terms of size. but ebay has loads of images of the products.
Please explain.
Store your files in the folder name returned by this:
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
It will return the local folder of your app in internal storage:
/data/data/#PACKAGE_NAME#/files
Store them in Resource folders (build action AndroidResource) as described in the Xamarin.Droid docs.
Make different sizes of your image for different screen-densities and store them in seperate folders as described in the Android developer documentation.

how can i keep a folder in my mobile storage and a folder in my dropbox space in Sync?

i have developed a android app for farmers. it is a informative app for indian farmer.The users will be sending me the images and video files to me through my app. here i used (integrated) dropbox to receive those files directly to my dropbox space. whatever the image or video taken by the user, it will be stored on a folder in my mobile storage. Here what i want is, i want the folder in my mobile storage to be in sync with the folder in my dropbox.
How can i do this?
there is a app in market called Foldersync which exactly fulfil my requirement. how they are doing it? How can i keep a folder in my mobile storage and a folder in my dropbox to be in Sync?
Note :
i have gone through drop-box api and created a simple app to send files directly to my dropbox space and i know how to download a entire folder from dropbox.
But here my question is unique from that... pls don't answer the above points which i already know..
Please help!
Thank You
You can use the Dropbox API to keep a local client in sync with Dropbox. There are two main pieces to this:
1) Metadata:
Assuming you're using the Core API, the best way to get information about all of the file and folders in an account (or optionally under a specific path) is to use /delta:
https://www.dropbox.com/developers/core/docs#delta
With this, you can get information about everything your app can see, and then easily stay up to date with changes. There are some useful blog posts on using /delta here:
https://blogs.dropbox.com/developers/2013/12/efficiently-enumerating-dropbox-with-delta/
https://blogs.dropbox.com/developers/2013/12/filtering-dropbox-delta-results-by-path/
2) File content:
Using the metadata retrieved from #1, you can download any files you need access to locally using /files (GET):
https://www.dropbox.com/developers/core/docs#files-GET
You can upload locally changed files using /files_put:
https://www.dropbox.com/developers/core/docs#files_put
Or, for larger files, use chunked uploading:
https://www.dropbox.com/developers/core/docs#chunked-upload
https://www.dropbox.com/developers/core/docs#commit-chunked-upload
The main work here will involve programming the logic in your app to correctly receive changes from the server as well as upload local changes, in order to keep everything in sync.
Also, be aware that on mobile devices, bandwidth can be limited and/or expensive, so be careful to not accidentally automatically download a lot of data the user doesn't want or need.

Sharing Files in Android with some partners using Dropbox

this is the first time I'm taking a look at the Dropbox API so I'm afraid I kinda don't understand much.
My purpose is to develop an App in which I place some files into a directory so as to be automatically uploaded to the server and synced in another device whose owner I'm sharing them with, so different accounts are being used of course.
In the end, it has to be something similar to Dropbox app itself: you are able to create a file, upload it and share it with some friends.
Any idea if this is possible, what to begin with, is it possible to use for this goal any folder i want or it has to be one particularly chosen by Dropbox...?
If you're asking for a way to programmatically share a folder with another user, the API doesn't currently support that. To do what you're doing, you would need to manually (with the Dropbox app or via dropbox.com) share a folder with the other user. From then on, you could use the Dropbox API to read from and write to that shared folder. (And the same would work from the other account, since the folder would be visible to both of you.)

Distribute air apps without recompiling

I'm developing an air image viewing application for Windows and Android that will allow some special users to import bitmaps to it. The user can click on a button, browse to a bitmap stored locally and then the app saves the image to the documentsDirectory.
Later on, other users (let's call then common users) will get this already compiled app and view the images imported by the special users.
My question is how can I make the app save the images within it without recompiling it?
Any ideas are welcome! Thank you all!
The only option I can think of, is to make a web server to store and load the images by those users. That's because the images will be stored in the documents or cache directory of the device which means that there is no automatic way to bring them to other devices.
You need a web server that the images will be uploaded and saved, and later on retrieved by other clients. It's called centralized assets system.

Categories

Resources