Too much network request does not fetches data from server? - android

I am making an e-commerce android application and faced a major issue.I am fetching data for display through remote server and using JSON format.There will be many images may be 40-60 images and some text content for a activity.Now what i do uptil now is that firstly i fetches json data from server which also contains image link with name in it.After that using glide i fetches all the images and show in it.During development phase,it works fine on localhost but when i deployed all backened files on server then a major issue arises.It does not fetches data and takes too long.My backened API is working i checked them in browser and postman.What i am doing wrong here ? Does too much network request gives this issue?And main point is that server and all the php and sql files are working fine.

Related

Best Practices for fetching json from server for android app

I have an Android app with 1 activity and 3 fragment opened in tablayout.
When a user open the app, the mainActivity fetch a json file from the server to check if the app version still in use and the first fragment fetch also a separate json file to feed the views. Every fragement fetch a separate json file to feed the there views with data.
The problem that I have is, that when the app has more than 100 active user, the json file did not get loaded and the okhttp get a timeOutException when trying to fetch the json file from the server. Basically when a user open the app, 4 json files will be fetched from the server, so I think the server has problem responding to all the requests.
So my question, what is the best practice to resolve such a performance problem, beside upgrading the server itself.
Thank you in advance

Data can not be fetched from one specific domain but workes on others

I am using android studio to fetch data from a cPanel/server and show in my android app. Problem is, data does not come from one specific server. But when I changes the server by changing the URL, the app works and data is showing. I uses same table and data in both server.
What could be the prob??

search through web-service with json

In my android application im using web-service to get information about food the problem that if i write appl instead of apple,row,skin it dosent fill automatically and an error message will be shown,, what i did i stored 2000 name from web service in sqlite and search through them is it wrong to do this ? and how can i search with misspelling in web-service without the error message ?
The api url http://api.nal.usda.gov/ndb/search/?format=json&q=apple&sort=n&max=25&offset=0&api_key=DEMO_KEY
Salam Enas,
If the data do change frequently (like a movies list) then it's not ok to store it in the sqlite and it's better to be stored in the server database.
If the data does not change frequently, then it's ok to store them on the sqlite database although the app size will increase by 2 Mb which is a drawback.
You may also want to consider other APIs if you are not committed to use this one.
When storing data on the server, HTTP requests burden can be alleviated by caching data on the mobile.
good luck :)

Phonegap : Loading content of apps dynamically

I am working on Phonegap android app which should take the content from my remote server.
After searching the things I found the 2 ways of getting the contents from remote server to phonegap App :
1. Getting the content using Ajax call to remote server by returning
the json data from remote server PHP file.
2. Getting complete HTML page from remote server using Ajax.
If i am going to implement one of the above, my app is going to send the request each and every time while loading the page which i think not a good idea.
I know very well how to implement above mentioned option in my App.
but i wanted to know which one is efficient.
How i can accomplished this?
I am also using the Jquery mobile.

Android app + Image storage and retrieval

I am designing a restaurant based app which has lots of images.
Please tell me:
How should I save images in the database i.e. in which format so that time of retrieval and display in the app is minimum? (Note: This database is a MySQL and located on an external server).
How should I retrieve them, i.e. which method to go for (JSON, etc)?
Dont use remote database server connection from application directly it may lead to slow performance . Instead use webservices as a intermediator between the database and your application. Your app should call a webservice which will internally query your database and return you the response . First response can be XML or JSON , but i would personally recommend you for the JSON as very fast from XML . Your first webservice response will return only the urls for images that you should download asynchronously so that UI thread is not hanged up .

Categories

Resources