• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor External database synchonization is using up all local memory.

Deemar

Newbie
I currently have this fully working, it's just using up all my RAM and my application can'at do anything else.

My application allows a salesman to do a quote for a customer and it will download any new quotes it finds on the server from other salesman, plus upload any quotes it has done while it was outside connectivity. The problem is it has to pull all quotes in order to compare them and see if a local update is needed. It has to pull the quote details, the customer's details, the local user's details and all the match tables in the database. It's a huge amount of data for the 10 quote test set I have right now and I was hoping to change that to a few hundred when moving into production.

When the application first runs, it does an initial check with the external database to see if anything changed, this takes about 90 seconds to run through all local tables and compare them to the JSON downloaded from the webserver's RESTful service. After that, when some memory has been freed up again, my application is free to run any database queries it needs to, this means loading the quote data takes at least 90 seconds when first opening the application and trying to view a customer quote quickly. How do I avoid this?

I'd like to put the synchronizer on a schedule every hour or so but if it runs while they're quoting, it'll hog all the memory again for 90 seconds. I guess I could synchronize just 1 of the 10 tables every 10 minutes but how do I decide which table? I'd need another table to keep track of that.

The local database is SQLite and the remote database is MySQL with almost 30,000 quotes across about 25,000 customers. Each quote has an associated Bill Of Materials (BOM) stored in another table. The point of having a local database is because we often quote on remote farms with no cellular / internet connectivity of any kind and we need to do a quote based on the most up to date pricing of the materials. We want to give the customer a copy of the quote before we leave.

The device I'm using is a Asus Z301MF tablet with a 1.3 gigahertz quad core processor but it runs just as slowly on my octocore OnePlus 5 phone because the application seems to be limited to 128 mebibytes of memory. Is there a better way to synchronize the data?
 
Back
Top Bottom