1 |
gabriel |
1 |
package com.cesams.twogetskills.inconcert.sync;
|
|
|
2 |
|
|
|
3 |
import android.accounts.Account;
|
|
|
4 |
import android.content.AbstractThreadedSyncAdapter;
|
|
|
5 |
import android.content.ContentProviderClient;
|
|
|
6 |
import android.content.Context;
|
|
|
7 |
import android.content.Intent;
|
|
|
8 |
import android.content.SyncResult;
|
|
|
9 |
import android.os.Bundle;
|
|
|
10 |
import android.util.Log;
|
|
|
11 |
|
|
|
12 |
import com.cesams.twogetskills.inconcert.Constants;
|
|
|
13 |
|
|
|
14 |
public class SyncAdapter extends AbstractThreadedSyncAdapter {
|
|
|
15 |
private Context mContext;
|
|
|
16 |
private final static String TAG = "C2GS - SyncAdapter";
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
public SyncAdapter(Context context, boolean autoInitialize) {
|
|
|
20 |
super(context, autoInitialize);
|
|
|
21 |
|
|
|
22 |
Log.d(TAG, "Construct");
|
|
|
23 |
/*
|
|
|
24 |
* If your app uses a content resolver, get an instance of it
|
|
|
25 |
* from the incoming Context
|
|
|
26 |
*/
|
|
|
27 |
this.mContext = context;
|
|
|
28 |
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
@Override
|
|
|
32 |
public void onPerformSync(Account account,
|
|
|
33 |
Bundle extras,
|
|
|
34 |
String authority,
|
|
|
35 |
ContentProviderClient provider,
|
|
|
36 |
final SyncResult syncResult) {
|
|
|
37 |
|
|
|
38 |
Log.d(TAG, "onPerformSync");
|
|
|
39 |
|
|
|
40 |
Intent intent = new Intent(Constants.BROADCAST_TYPE_SYNC_TO_SERVER_OR_CHECK_CHANGES);
|
|
|
41 |
mContext.sendBroadcast(intent);
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
}
|