Data shared in offline native apps

Hi,   We want to create an app which users can use offline. There are several data that will be shared between users. If two users change the same data while they are offline, what would happen?    For example, if two users share some points to redeem and decide to redeem these points offline at the same time, what should happen?   Thanks,  Mikel Castro
1 answers



If two users make conflicting changes to the same data while they are both offline, there can be conflicts when they both go online and try to synchronize their changes. It is important to have a conflict resolution mechanism in place to handle such situations.

In the scenario you described, if two users redeem the same points offline, it is possible that they both end up with negative point balances when they try to synchronize their changes online. In order to avoid this, you could implement a conflict resolution mechanism that checks for conflicts when the data is synchronized and resolves them based on some rules. For example, you could prioritize one user's changes over the other, or prompt the users to manually resolve the conflict.

In general, it is a good practice to design your offline application in such a way that it minimizes the potential for conflicts. This can be achieved by restricting access to certain data while offline, or by implementing locking mechanisms that prevent multiple users from editing the same data simultaneously.