I am developing an android app which shows history of stock and financial data for the past years. For each stock data it gives me a file which is bigger more than 30mb. And i have 10 files that I want to use.
I want to access data in these files as strings. I have thought of putting them in raw or assets folder of my app, but you can imagine how big the app would be if each of the 5 files is 30mb size.
I also tried to copy data to string file of the app, i am getting error message which says such a very long string is not supported.
Currently um thinking of uploading data to realtime firebase database then access it from there, but i still have plenty question marks that, if i try to access it from firebase, the strings would still be big and un supported.
My question is, what is the base way of using big strings more that 30mb on my app, a solution with sample code will save my life.
CodePudding user response:
You can use BLOB or CLOB for inserting large strings to the DB.
CodePudding user response:
As you said you have 5 files 30mb each and you are right you should not keep that file in apk or store as string,
- if you store as string it will cause unnecessary high memory usage
- if you store these file in apk your apk size will increase (while downloading)
so my first approach would be to store those file as asset in any network location and when user install your app you ask them to download (It is still a naïve approach) you have to still process that file in local which will take some resource.
as you said that file contains history of stock and financial data so I assume those data would be in correct/manageable format so what you can do is insert all those data in a database according to different stock/year whichever you like and get that data in app in real time, when user want to see specific stock history they choose that stock and you pull all related history from the database and show on the screen. for this you need to process all those file 1 time and store in database and then you can use it anywhere efficiently. You should focus on that approach in which you don't take user resource too much, it will destroy the user experience and no one will use your app.