Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

android - How to Improve an App Performance that uses Internet to work ??? [WhatsApp Clone]

I am building an App that has same functionality as WhatsApp. I am using firebase(Online Mode) and Room(Offline Mode). I want that my code should determine when to fetch the data from firebase and when the user is offline just store and show the data using Room Db and whenever the user goes online update in firebase.

Flow: If Online: Check if Database have changes if yes fetch data and store locally in Room. Check if Room Db is changed if yes update UI. [UI should only get data from Room Db]

If Offline: Store the data locally and change the UI instantly and whenever the user goes online update firebase.

If this is not the optimised solution in respect of App Performance. Please share your thoughts


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are trying to build whatsapp clone. You have to save datas to sqlite when user is online. And, when you are online then, you have to check the size of that person's information. If size changes it means someone messaged him or happened something to database. Then, you can change sqlite information. I think you are just looking for idea not source code. If you want to know source code. Then, implement your source code where you are having error.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...