Best Practice to save data and images on App [closed] - android

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to design an App to display short stories and images belong to this story.
I think I have two scenarios:
a- save the data in SQLite and attached with the app.
b- save images in a drawable folder.
(But the App size will be big because of the images saved in drawable folder)
save data and images on server and App pull the data.
My questions:
1: Which is the best scenario 1 or 2?
2: in case I choose the scenario -2- is possible to use firebase, like I want to put the data and images on the firebase and just the apps are authorized to pull these data?
3: Any new scenario for best practice to achieve that?

I choose second one.
We can include dynamic content.
Small APK size.
If new story comes, no update to your App. the existing app will show the new story.
Not only one include thousands, lacks, millions oru trillions
Firebase is currently Available best option. Only the difficulty is designing the data storing in the firebase. And you can fetch dynamically or first time. and Fcm push notification, you can include if you insert new stories.
For image you can use different libraries.Fresco, Glide, Picasso
And Another option is Designing your own server. It include other programming knowledge and a host also
But fcm free pack only 100 connections are allowed at a time.

Choose Firebase.
This will give you the flexibility to update the content (Images/Stories) remotely. Firebase Database you can use to store the text data and Firebase Storage to store the media files.

Related

Android with Kotlin best ways to storage a custom class [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
this is the first time that I need to store some data permanently so I would like some suggestions before to proceed. I've read that there are different ways to store data on an Android device:
Internal storage
Shared Preference (but if I've understood is just for symple data like an option)
Shared storage (but I don't need to share data among other apps)
Database
I can't understand what is the best option for me between the first and the last.
My case
I have a list of book with title, subtitle, cover image and each book contains a list of cards with title, optional image, (audio if possible), other stuff.
So, I have to store an arraylist of a custom class that includes another arraylist of anothercustomclass and some text/image
Which approach should I take?
Thanks
Frankly, the case description is much too limited to give an informed advice (so the question should be closed).
But if you have doubts, then the safe / default choice is the database. It might come with big overhead for some cases (like when it's enough to serialize the whole arraylist to a blob and store as a single file), but you are less likely to paint yourself into a corner.
Addition (after a comment)
When using a database, you don't store objects directly (because what an sql database stores are "relations" which you can think of as "sets of rows", not objects). Instead you have some code (custom or from a library) that translates an object into a row (or multiple rows) for storage and some code that translates it the other way.
If you want to store the actual objects, then serialization to a file is pretty much the only way.

Best practice: store image and text in Android [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am doing a simple app where I take a picture, fill some text from the UI and store the image + text together.
Eventually the user can select the picture from a recyclerview and edit the associated text (or delete the whole image + text group).
I have no hint on what kind of data structure should be used.
I heard that SQL lite should be used for such tasks - since the text data could change according to the user actions, but I think that using tables (one or more) for the purpose of storing images and text could be overkill - also because I don't expect to have a lot of images in my app.
I'm wondering if any other data structure is available for this purpose (similar to C strctures, or python dictionaries).
Also, any kind of hint about keyword to search for this topic or resource would be really appreciated.
Just for the sake of discussion, I am developing using kotlin.
For storing images, you should store them as files, and store file paths of those images in the database with text. Moreover, when you read it back you can use Picasso or Glide to load those image paths into ImageView.
Also, if you want to store images in external storage, make you request runtime-permission and add permission to the manifest file.
However, if you store files in internal storage, you don't need to request permission.
Learn more about Runtime-Permission and Storage in Android.
I would suggest use Room for working with SQLite in Android.

Best Practices: Whats the best approaches to handle the unexpected errors between writing into Firestore and Uploading to Cloud Storage [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I am developing a phone application using Firebase cloud services. The App is publishing new activities with images and captions.
The way I'm thinking is writing activity first into Firestore and then use the Firestore's generated id to name the image in Cloud Storage.
But, The question is. What's the best approach to handle errors if the app was able to write into the Firestore BUT not able in Storage? How is the whole thing will impact the user experience?
Not Sure, If saving the image into the phone filesystem temporary until getting it uploaded the right wat? OR Prompt the user about the failing process? But again this will costly by deleting the activity from Firestore or how to manage it if the user already lost the connectivity for some reason.
There are a lot of items it could happen during this process with a lot of possibilities. What do you think?
Thanks,
There is really no "best practice" here, other than writing the code that meets the needs of your app.
If an operation fails for whatever reason, and you need to revert other operations due to that fail, you will simply have to write code that undoes what you did previously. So, if you created a document in Firestore, then uploaded an image in Cloud Storage, but the upload failed, you will have to decide what you want to do with that document. Maybe you want to delete it, or maybe leave it around to use later. It's up to you - we can't tell you what your app ought to do, but you can write the code that does exactly what you want.

Suggestions regarding how to make web-service [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am starting with a new app i which i will be needing web services.All the data will be coming from the data base.My database will look something like this
Id
Name(Birds Name)
Description
Date
Image for that Name
Now i want to give all the values to user in json array.But i am confused on few points
How will i send images in json array
Is it correct to store Images in Database?
There may be 3-5 images for a particular name,so do i create a different table for images with foreign key??
P.S-Also it would be grateful if some one can give me link on how to make a web-service which i can consume in my android application
To answer your questions:-
To send images in JSON Array, you need to convert your images into BASE64 first and then add it in your JSON Array object. This BASE64 type can be received on the webserver and a reverse operation could be performed to get the actual image.
NO. Images are never stored in Database. Rather store their corresponding path. Its always better to save images on the external storage.
Yes. You can create a separate table, but to store the path of images, not the images itself. You can then use foreign key to acces the images path and then the images respectively.
Regarding the techno, I use Google App Engine + Endpoints. A good choice, because endpoints generate with Maven the model for the Android app based on your AppEngine datastore.

Should I use sqlite? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
In my app i want to add a new feature that consist in having a list of object's bought by the user. So, when the user buy something he add's that object to the list. Later, if he starts the app again,there should be all the items added in the list.
The object will have some parameters (name, bought date, price, etc etc). My question is: is this a case to use sqlite?
If yes, In the activity with the list of the objects, everytime the activity starts I will have to load the table from database?
The answer to your first question is "yes". The answer to the second is, also, "yes".
Should I use sqlite?
Well, it depends on your preference and the scenario,
If you are using a webserver and updating the webserver, no need
to use a sqlite since you can ping a query to server and show the
objects for the list
If you are not using a webserver you can use Sqlite for this
scenario since you can perform all the
CRUD(Create,Read,Update,Delete) operations for the Sqlite
Advantages and disadvantages of using SQlite
Pros:
If your application gets closed the in memory data will be lost, but after that you will be able to restore the state from the database if you have one
Especially for the case of complex calculations it is good to store the result once in the database and not recalculate it multiple times on demand
The database will untie your UI from the internet connection and thus you will be able to display results even if there is not internet connection
Using database you will be able to fetch the updated data from a background service, without impacting your UI
Organizing your data in database usually makes it a lot easier to manage all the application data.
Cons:
Adding database will require a bit of additional effort on your side
Sinple Line :: Go for Sqlite solution

Categories

Resources