Skip to content

Synchronization problem #395

Description

@belallioui

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions