Suggestions regarding how to make web-service [closed] - android

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.

Related

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.

android - dictionary to translate strings [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 5 years ago.
Improve this question
I have a lot of String code values that come from server, and I want to translate this codes to strings.
I can get key and value (code : string) from server every week and store/update them.
What is the best way to store, update, and read/use this data, over whole activities of app?
Thanks.
You have the following alternatives:
Shared Preferences - a persistent key value store. You can write values, that are stored to files, that are accessible in the app context.
Database - use the built-in SQLite instance or a third party DB of your choice. The data is persisted and also accessible from within the app context. Extracting the values may be a bit over complex for your case.
Plain files in a custom format that fits your use case - you can create and store files that are private to your app and store and extract info from them. You will have to deal with the file format and operations in a custom way.
As a whole, fetching your string resources from the network is not a very good approach. In this way you have to deal with localisation and internationalisation in a custom way and can't use the built-in goodies provided by the Android OS.

How to view data, that are parsed from the MySQL database, in offline, using SQLite? [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 5 years ago.
Improve this question
I am developing my school's timetable app for android. I am getting timetable data from MySQL database. -> I have access to the timetable, only when I have an internet. But I want to make timetable accessible without the internet. I read that I need to save data from MySQL to the SQLite, and then use them. Can you, please, give me links to the samples how do to that?
I can point you in a direction that you might want to go in, you can try to use a ContentProvider to store and read data on your device offline. Once you create your ContentProvider, make use of your school's API through an AsyncTask (provided you have permission to access it) to format you some JSON to parse in Java with a library like Gson.
Basically this relationship becomes like this:
(Server)----JSON---->(AsyncTask)---->(Parse JSON in Client)---->(Move Parsed JSON data to your app's ContentProvider).
There are numerous articles on things like this:
ContentProvider example:
https://developer.android.com/guide/topics/providers/content-provider-creating.html
(Udacity also has free videos describing ContentProviders and JSON retrieval and parsing.)

Best Practice to save data and images on App [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 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.

What I should pick - JSON or 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 9 years ago.
Improve this question
In my application, on every launch at first some JSON have to downloaded from server and later I need to show various information by parsing this data one the full app life-cycle. The JSON object is pretty big with almost 5000 JSONArray. Every JSON array is of the following form:
[37,101,"The Blocks Problem",9952,0,1000000000,0,852,0,0,11197,0,16606,0,7279,200,18415,5325,14492,3000,1]
So I have two option:
Save the json string into a file and later read it.
Save the JSON array in SQlite database with almost 10 columns and 5000 rows.
The first option seems to be efficient. But later I have to manipulate the JSON for displaying various information. In some cases, I need to search full array to pick on array information and there are many cases like this. So this would be very time consuming also.
The second option is better for searching and displaying faster. So I approached on with the second option. But the insertion of 5000 rows at a time is time consuming also. I did it in AsyncTask for betterment but it is taking too much time to be executed - parsing JSON and store in SQlite table.
So what can I do? what is the best way to store this huge information and later use it efficiently?
I answered a question pretty close to this today - File or Database? - Best Practice to save Objects on Android-Device. I wanted to add that if inserting 5000 rows is taking too long, try adding them all in a single transaction, or using a bulk load mechanism. It's worth the effort to figure out your insert problem instead of trying to use files.
See this tutorial about bulk loading SQLite

Categories

Resources