Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronization problem #395

Open
belallioui opened this issue Oct 17, 2020 · 0 comments
Open

Synchronization problem #395

belallioui opened this issue Oct 17, 2020 · 0 comments

Comments

@belallioui
Copy link

Hello,
I have a timing problem when I modify the stockPiking and its stock movements.
the data entered in the stockPicking mobile application is sent.
The stockMove data is saved at the base level of the mobile application.
But after synchronization the stockMove of the tablet crashes with those of the server.

it's like syncronization is done in these directions:
StockPicking app Mobile >> Server
StockPicking Server >> Mobile App
StockMove Server >> Mobile App
this overwrites the new data from stockMove App Mobile with those from the server.

Code :

public class StockPickingService extends OSyncService implements ISyncFinishListener {

    public static final String TAG = StockPickingService.class.getSimpleName();
    private Context mContext;
    @Override
    public OSyncAdapter getSyncAdapter(OSyncService service, Context context) {
        mContext = context;
        return new OSyncAdapter(context, StockPicking.class, this, true);
    }

    @Override
    public void performDataSync(OSyncAdapter adapter, Bundle extras, OUser user) {
        if(adapter.getModel().getModelName().equals(StockPicking.MODEL_NAME)) {
        
            adapter.onSyncFinish(this);
        }
    }

    @Override
    public OSyncAdapter performNextSync(OUser user, SyncResult syncResult) {
        return new OSyncAdapter(mContext, StockMove.class, this, true);
    }
}

public class StockMoveService extends OSyncService {

    public static final String TAG = StockMoveService.class.getSimpleName();

    @Override
    public OSyncAdapter getSyncAdapter(OSyncService service, Context context) {
        return new OSyncAdapter(context, StockMove.class, this, true);
    }

    @Override
    public void performDataSync(OSyncAdapter adapter, Bundle extras, OUser user) {
        if(adapter.getModel().getModelName().equals(StockMove.MODEL_NAME)) {
            adapter.syncDataLimit(80);
        }
    }


}

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant