Always connect to Webservice or local storage Android? - android

I'm developing a personal project with Android and struggling here with some doubts about the better way to develop it.
Well, my project consists of my app consuming a Rest Webservice (which I already developed with Java and Spring) and showing up a list of places on it. The thing is: This list could be huge, something like 2000- 3000 records with description and picture of each place.
I'm using volley and OKHttp to take care of my networking stuff, so far my list of places isn't that long, so everything is alright, but I'm afraid when the list starting to get big, I don't know how my app will handle this.
My questions would be:
1- Should I store the that list on my device and update the list every time I connect to the webservice?
2 - Am I doing correct, retrieving the entire list with just one request? If not, how's the best way to do it?
Thank you guys, I'm new to android stuff, and I'm developing everything by myself, don't have anyone experience around to ask that.
Cheers!

As mentioned in comments You need your app to do "paging" and to load some of the content every time you scroll down.
For example if you will open Facebook app and go over photos you will notice that the first ones always loading the fastest and as you keep scrolling some will be left blank for few moments, thats what paging is all about.
Make sure though not to overload the app with info, specially if you use bitmaps
You can read some good tutorials here

Related

How to configure a list of API requests per screen in React Native

At this point I am not very sure if what I want to do is recommended or if it even has a pattern name.
I currently have a mobile app as a frontend. It shows a card feed that can be configured from the backend. I can say which cards to show, which information, etc.
Right now, the issue is that I load them all at once. For those familiar with React Native, I use a ScrollView which automatically renders all the cards/requests at once.
I would like to improve this, by having one single requests per page, and the response should return the list of API requests that actually load the information.
Like a first API request that brings the configuration of the screen, and then using a ListView to show each requests. The difference is that every request should be actually loaded when they appear on screen. Also, I could support pagination.
Is there any framework that could help? Best practices?
Thanks
PS. I understand this could be opinion based but I am trying to understand if this already has a patter name or framework that could do this for me.
Having an API request that fires on each screen, solely to tell the screen which other API requests to make, is quite inefficient. It sounds like you want an infinite scroll view with pagination on the API side, so you can load a sensible amount of records each time, and then as the user scrolls, load in more below.
There is a good RN package at https://github.com/expo/react-native-infinite-scroll-view for this - the docs are pretty good, but basically the key props are canLoadMore, which tells the scroll view whether it should try to load more content or if it's at the end, and onLoadMoreAsync, where you can provide an async function to fetch the next page of records.
Hope that helps!

Best practice for android dynamically load Listview at scroll end?

I have been working on an android project that has a feed similar to Instagram/Facebook and I am trying to figure out the best strategy for consuming the data from my database.
Specifically I am wondering if I should query all the data at once (assume 50 records +) or if should I perform queries as the user scrolls -- grabbing so many records at a time. If the ladder, about how many posts/records should I get per query assuming the content/size is similar to that of a Facebook post.
I've spent a descent amount of time researching this issue and haven't come across anything so any suggestions would be much appreciated. I do apologize if this issue has already been addressed and if you could you just post the location of the answer that'll work too.
Thanks in advance!!
Fetching all the data can be too much at times and your app will have very slow response time, that why it's better to load some data at a time and just add it as you get it. In my opinion it's best to load 2 screens of data at a time, so try and see how many posts you can have in a screen and get x2 (if on one time you can see 5 posts, load 10 at a time) or load for example 10 at the first time and 5 each next time. This truly is your preference as I think.
If this is the method you want to use keep in mind that there are different screen sizes for android (from android wear to different sized mobile phones, tablets and smart tv-s) so try making different methods for each group if devices. You can maybe have an abstract class (or interface) with the method and have every other class for different size extend or implement (regarding of using class or interface) to make the code more well written, easier to change and reusable.
But all in all it's in your hands and you can make it by your liking. Hope this helps, and gives you some matter to wrap your head around.

Expose data from same back end to multiple clients

I am a new guy to full stack web application development. I want to design a web application which has data stored in say back end databases. Now I want to design a desktop web client as well as android application which will be able to fetch data from back end. So how do I need to start? What APIs can be used or how can I expose data from same back end to multiple clients?
Also I want to handle massive amount of request. How to design such a system? What to use in back end to store data and handle requests efficiently.
Any video / document / reference containing useful information will be much appreciated.
Wow, you have a whole forest of questions to settle. You are going to need to go do your own research on such things as algorithms and data flow for your application before you can make any reasonable choice of platform. Here are a couple of basic ideas to get you going: 1) look at Java and Node.js. There are lots of other possible platforms but chances are you will end up using one of those two. Try to think about what the actual code you will generate in each of those will look like. A little or a lot? 2) Just store your data in files, most probably using JSON. Maybe you will end up doing something more fancy after you figure out where you are going with your project, but you will be surprised how well the simple file-based solution will scale.
When you have done a bunch more research, and maybe even coded up a few ideas on your platform of choice, then come back and massively edit your question. Only then will specific suggestions for tool choices be possible.

Making an android app with 365 imageviews

I need help understanding how I would approach making an Android application that allows the user to scroll through 365 different bitmaps. I'm worried that I will go outside of the memory limits that android allows. I've tried googling, but haven't been able to understand how to approach the problem. Could someone write a very brief hint at where i can start researching this?
It depens on the source of those. I think you would like to use "lazy load ListView".
Checkout this
how about using any class that extends from AdapterView (like listView, gridView,...) ?
the idea is that since the user doesn't really see all of the views at the same time , you can re-use views that are being disappeared when scrolling , and show them as new ones .
watch the video of google called "the world of listView" .
anyway , if you don't wish to use this solution , consider being very "cheap" on the memory , as you are correct - android will kill your app if you use too much RAM .
you can read about handling bitmaps here .

Android, preferred method for accessing 10,000+ record database on server

So I am in need of some assistance in trying to determine what I am going to need in order to accomplish a task.
Plain and simple...I am looking at accessing multiple databases some of which may contain over 10,000 records via Android. From what I have seen web services that return JSON is the way to go for something of this nature, but I don't think that fully answers my question or know if this is the preferred way to go about this.
Digging a bit deeper...I have a few apps on the market now, but this will be my first attempt at an enterprise style app, and I have accessed public web services with a lot smaller footprint than what this is going to be. I have little to no experience within the realm of server/network administration which is where I am getting tripped up. This is from the ground up and I have to ability to obtain almost any resources I need to complete this task.
It appears that there is a SQL Server 2008 on the back end if that helps. If I need to provide further details let me know. I am looking at a solution that will handle organizational growth, scalability, authentication and ease of user...so keep that in mind too.
So what is the best practice/preferred method for doing an enterprise application with a substantial data set? What are the big dogs doing, and how? Both on the client side and server side. I am trying not to "screw the pooch" out of the gates on this, and this is one of those measure twice and cut once situations which is why I am trying to garner plenty of input and assistance.
Thanks in advance!
If you don't have an API/service yet, you need to write one on top of your database.
I can think of two approaches, depending upon your use case.
Paging: Setup an API that supports paging, and show the results page by page. The user can't possibly view 10000 records in one go.
Search and suggest: Try creating a suggestion list, when the user starts typing out something. Fetch results that start with the initial characters entered. However, the API should limit the results to a comfortable number, so that you don't have to parse a lot.
Depending on your use case, you could try one of these.

Categories

Resources