Search code examples
androidfirebasegoogle-cloud-firestorefirebase-authenticationgoogle-cloud-storage

how can i store data for my android app so that when someone login from different device he can see his data can firebase be used


i am making an app using kotlin. this app is like a diary for user where they can write about the day how can i store the data so that even if user uninstall it or open the app in different device they can see there data. can i use firebase for that do i have to pay for i only have very few users.

i want to store the data of my app user so that it doesn't get lost can i use some api or something to do so i dont want to pay for any service as it is only for very few users(experiment purpose). please tell where can i find an api which will be helpful in this case.


Solution

  • First, You need to define which server you will use to store user data (Firebase, Personal server.. etc).

    Then you had multiple choices to SYNC user data with the server

    Synchronization Service

    You can use the power of WorkManager

    to do the job for you. By storing every new diary object inside RoomDB by inserting it to the DB and after successful insertion you can SYNC your data with your server using WorkManager and delete the diary object after successful update.

    OR

    You can insert every single diary in RoomDB as a list of diaries after saving it, and while the app is launching you can SYNC this list of diaries with your server.