Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 27 | Rev 29 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 27 Rev 28
Línea 2... Línea 2...
2
 
2
 
3
import androidx.activity.result.ActivityResultLauncher;
3
import androidx.activity.result.ActivityResultLauncher;
4
import androidx.activity.result.contract.ActivityResultContracts;
4
import androidx.activity.result.contract.ActivityResultContracts;
5
import androidx.annotation.NonNull;
5
import androidx.annotation.NonNull;
6
import androidx.appcompat.app.ActionBarDrawerToggle;
-
 
7
import androidx.appcompat.app.AlertDialog;
6
import androidx.appcompat.app.ActionBarDrawerToggle;
8
import androidx.appcompat.app.AppCompatActivity;
7
import androidx.appcompat.app.AppCompatActivity;
9
import androidx.core.app.NotificationCompat;
8
import androidx.core.app.NotificationCompat;
10
import androidx.core.content.ContextCompat;
-
 
11
import androidx.core.view.GravityCompat;
9
import androidx.core.content.ContextCompat;
12
import androidx.fragment.app.Fragment;
10
import androidx.fragment.app.Fragment;
Línea 13... Línea 11...
13
import androidx.fragment.app.FragmentTransaction;
11
import androidx.fragment.app.FragmentTransaction;
14
 
12
 
15
import android.accounts.Account;
13
import android.accounts.Account;
16
import android.accounts.AccountManager;
14
import android.accounts.AccountManager;
17
import android.app.NotificationChannel;
15
import android.app.NotificationChannel;
18
import android.app.NotificationManager;
16
import android.app.NotificationManager;
19
import android.app.PendingIntent;
17
import android.app.PendingIntent;
20
import android.content.ContentResolver;
18
import android.content.ContentResolver;
21
import android.content.DialogInterface;
19
import android.content.SharedPreferences;
22
import android.net.ConnectivityManager;
20
import android.net.ConnectivityManager;
-
 
21
import android.os.Build;
23
import android.os.Build;
22
import android.os.Handler;
24
import android.os.Handler;
23
import android.preference.PreferenceManager;
25
import android.text.TextUtils;
24
import android.text.TextUtils;
26
import android.util.Log;
25
import android.util.Log;
27
import android.content.Context;
26
import android.content.Context;
Línea 33... Línea 32...
33
import android.view.View;
32
import android.view.View;
34
import android.widget.ImageView;
33
import android.widget.ImageView;
35
import android.widget.PopupMenu;
34
import android.widget.PopupMenu;
36
import android.widget.ProgressBar;
35
import android.widget.ProgressBar;
37
import android.widget.TextView;
36
import android.widget.TextView;
38
import android.widget.Toast;
-
 
Línea 39... Línea 37...
39
 
37
 
40
 
38
 
41
import com.bumptech.glide.Glide;
39
import com.bumptech.glide.Glide;
Línea 86... Línea 84...
86
import com.cesams.twogetskills.entity.UserLog;
84
import com.cesams.twogetskills.entity.UserLog;
87
import com.cesams.twogetskills.preference.Preference;
85
import com.cesams.twogetskills.preference.Preference;
88
import com.cesams.twogetskills.receiver.ConnectivityReceiver;
86
import com.cesams.twogetskills.receiver.ConnectivityReceiver;
89
import com.cesams.twogetskills.receiver.InternalReceiver;
87
import com.cesams.twogetskills.receiver.InternalReceiver;
90
import com.cesams.twogetskills.room.ResultCount;
88
import com.cesams.twogetskills.room.ResultCount;
91
import com.cesams.twogetskills.viewdata.SlideRefreshUIViewData;
-
 
92
import com.cesams.twogetskills.viewmodel.SlideRefreshUIViewModel;
-
 
93
import com.google.android.material.bottomnavigation.BottomNavigationView;
89
import com.google.android.material.bottomnavigation.BottomNavigationView;
94
import com.google.android.material.navigation.NavigationBarView;
90
import com.google.android.material.navigation.NavigationBarView;
95
import com.google.android.material.snackbar.Snackbar;
91
import com.google.android.material.snackbar.Snackbar;
96
import com.google.android.material.navigation.NavigationView;
-
 
Línea 97... Línea 92...
97
 
92
 
98
import androidx.drawerlayout.widget.DrawerLayout;
93
import androidx.drawerlayout.widget.DrawerLayout;
99
import androidx.appcompat.widget.Toolbar;
-
 
100
import androidx.lifecycle.ViewModelProvider;
-
 
Línea 101... Línea 94...
101
import androidx.room.Database;
94
import androidx.appcompat.widget.Toolbar;
102
 
95
 
Línea 103... Línea 96...
103
import com.cesams.twogetskills.Constants;
96
import com.cesams.twogetskills.Constants;
104
import com.cesams.twogetskills.R;
97
import com.cesams.twogetskills.R;
105
 
98
 
106
import com.cesams.twogetskills.fragment.IntroFragment;
-
 
Línea 107... Línea 99...
107
import com.cesams.twogetskills.fragment.SigninFragment;
99
import com.cesams.twogetskills.fragment.IntroFragment;
108
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
100
import com.cesams.twogetskills.fragment.SigninFragment;
109
import com.google.firebase.messaging.FirebaseMessagingService;
101
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
Línea 110... Línea 102...
110
 
102
 
111
import org.json.JSONArray;
103
import org.json.JSONArray;
112
import org.json.JSONException;
104
import org.json.JSONException;
113
import org.json.JSONObject;
105
import org.json.JSONObject;
114
 
106
 
115
import java.io.IOException;
-
 
116
import java.text.SimpleDateFormat;
107
import java.io.IOException;
-
 
108
import java.text.SimpleDateFormat;
117
import java.util.Calendar;
109
import java.util.Calendar;
118
import java.util.Date;
110
import java.util.Date;
119
import java.util.HashMap;
111
import java.util.HashMap;
Línea 120... Línea 112...
120
import java.util.Iterator;
112
import java.util.List;
121
import java.util.List;
113
import java.util.Observable;
Línea 145... Línea 137...
145
    private ActionBarDrawerToggle mDrawerToggle;
137
    private ActionBarDrawerToggle mDrawerToggle;
146
    private ImageView navHeaderUserImage;
138
    private ImageView navHeaderUserImage;
147
    private TextView navHeaderUserName;
139
    private TextView navHeaderUserName;
148
    private TextView navHeaderUserEmail;
140
    private TextView navHeaderUserEmail;
Línea -... Línea 141...
-
 
141
 
149
 
142
 
150
    private HashMap<String, Fragment> fragmentHashMap;
143
    private HashMap<String, Fragment> fragmentHashMap;
Línea 151... Línea 144...
151
    private TextView textViewMessageNotConnection;
144
    private TextView textViewMessageNotConnection;
Línea -... Línea 145...
-
 
145
 
152
 
146
    BottomNavigationView mNavigationView;
153
    BottomNavigationView mNavigationView;
147
 
154
 
148
 
155
 
149
 
156
    private Preference preference;
150
    private Preference preference;
157
    private boolean connected = false;
151
    private boolean connected = false;
158
    private ConnectivityReceiver mConnectivityReceiver;
152
    private ConnectivityReceiver mConnectivityReceiver;
159
    private InternalReceiver mInternalReceiver;
153
    private InternalReceiver mInternalReceiver;
160
    private ProgressBar mProgressBar;
-
 
Línea 161... Línea 154...
161
    private Toolbar mToolbar;
154
    private ProgressBar mProgressBar;
162
    private Account mAccount;
155
    private Toolbar mToolbar;
Línea 191... Línea 184...
191
        Log.d(TAG, "MainActivity onCreate");
184
        Log.d(TAG, "MainActivity onCreate");
Línea 192... Línea 185...
192
 
185
 
Línea 193... Línea 186...
193
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
186
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
-
 
187
 
194
 
188
        preference = Preference.getInstance(getApplicationContext());
Línea -... Línea 189...
-
 
189
 
-
 
190
        preference.load();
-
 
191
 
-
 
192
        //Comprobamos que las preferencias del servicio sean accesibles desde aqui
-
 
193
        Log.e("TOKEN","this: "+preference.getDeviceToken());
-
 
194
        Log.e("DEVICE","this: "+preference.getDeviceUuid());
-
 
195
 
-
 
196
/*
-
 
197
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
-
 
198
            String uuid = UniqueID.id(getApplicationContext());
-
 
199
            preference.setDeviceUuid(uuid);
-
 
200
            preference.save();
-
 
201
 
-
 
202
            Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_DEVICE, uuid);
-
 
203
            mAppDatabase.getSyncDao().insert(sync);
-
 
204
 
-
 
205
            if(!TextUtils.isEmpty(preference.getDeviceToken())) {
-
 
206
                sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, preference.getDeviceToken());
-
 
207
                mAppDatabase.getSyncDao().insert(sync);
-
 
208
            }
-
 
209
           // syncToServerOrCheckChanges();
-
 
210
*/
-
 
211
 
195
        preference = Preference.getInstance(getApplicationContext());
212
 
Línea -... Línea 213...
-
 
213
 
196
        preference.load();
214
/*
197
 
215
        handler = new Handler();
Línea 198... Línea 216...
198
        handler = new Handler();
216
 
199
 
-
 
200
        final Runnable r = new Runnable() {
217
 
201
            public void run() {
218
        final Runnable r = new Runnable() {
202
 
-
 
203
                if(TextUtils.isEmpty(preference.getDeviceUuid())) {
219
            public void run() {
Línea 204... Línea 220...
204
                    //  Log.e("Encontre","vacio el preferencie"+preference.getDeviceUuid());
220
 
205
                    String uuid = UniqueID.id(getApplicationContext());
221
                if(TextUtils.isEmpty(preference.getDeviceUuid())) {
-
 
222
                    String uuid = UniqueID.id(getApplicationContext());
Línea 206... Línea 223...
206
                    preference.setDeviceUuid(uuid);
223
                    preference.setDeviceUuid(uuid);
207
                    Log.e("Device", "nuevo " + uuid);
-
 
208
                    preference.save();
-
 
Línea -... Línea 224...
-
 
224
                    preference.save();
-
 
225
 
-
 
226
                    Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_DEVICE, uuid);
209
 
227
                    mAppDatabase.getSyncDao().insert(sync);
210
                    Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_DEVICE, uuid);
228
                    syncToServerOrCheckChanges();
-
 
229
 
211
                    mAppDatabase.getSyncDao().insert(sync);
230
                }
212
 
231
 
213
                }
232
 
214
                if(TextUtils.isEmpty(preference.getDeviceToken())) {
233
                if(TextUtils.isEmpty(preference.getDeviceToken())) {
215
                    Log.e("Aun sin token "," vamos a esperar");
-
 
216
 
234
                    //Aun no hay token FCM, repito la comprobacion..
217
                    handler.postDelayed(this, 2000);
235
                    handler.postDelayed(this, 2000);
218
                }
-
 
219
                else
236
                }
Línea 220... Línea 237...
220
                {
237
 
221
                    Log.e("Ya tengo"," token");
238
                else
222
                    if(TextUtils.isEmpty(preference.getDeviceUuid())) {
-
 
223
                        //  Log.e("Encontre","vacio el preferencie"+preference.getDeviceUuid());
239
                {
224
                        String uuid = UniqueID.id(getApplicationContext());
-
 
225
                        preference.setDeviceUuid(uuid);
-
 
226
                        Log.e("Device","nuevo "+uuid);
240
                    //Ya tenemos token FCM, verificamos de nuevo si tenemos Device Uuid
227
                        preference.save();
241
                    if(TextUtils.isEmpty(preference.getDeviceUuid())) {
228
 
242
                        String uuid = UniqueID.id(getApplicationContext());
229
                        Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_DEVICE, uuid);
243
                        preference.setDeviceUuid(uuid);
230
                        mAppDatabase.getSyncDao().insert(sync);
244
                        preference.save();
231
 
-
 
232
                        Log.e("Token a este", "punto: "+preference.getDeviceToken());
245
 
233
 
246
                        Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_DEVICE, uuid);
234
 
247
                        mAppDatabase.getSyncDao().insert(sync);
235
                    }
248
                        handler.postDelayed(this,2000);
236
                    else
249
                    }
-
 
250
                    else
-
 
251
                    {
-
 
252
                        if(isSyncDevice) {
237
                    {
253
                           Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, preference.getDeviceToken());
238
                        if(!TextUtils.isEmpty(preference.getDeviceToken()) && isSyncDevice) {
254
                            mAppDatabase.getSyncDao().insert(sync);
239
                           Sync sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, preference.getDeviceToken());
255
                            syncToServerOrCheckChanges();
240
                            // Log.e("Intento","Sync token to server"+preference.getDeviceToken());
256
                        }
241
                            mAppDatabase.getSyncDao().insert(sync);
257
                        else
Línea 242... Línea 258...
242
                            syncToServerOrCheckChanges();
258
                        {   //Tengo el FCM Token pero no se ha realizado el Sync del Device ID
-
 
259
                            syncToServerOrCheckChanges();
Línea 243... Línea 260...
243
                        }
260
                            handler.postDelayed(this, 2000);
244
                        {
261
 
Línea 245... Línea 262...
245
                            Log.e("Tengo el FCM"," pero no he syn el device");
262
                        }
246
                        }
263
                    }
Línea 247... Línea -...
247
                    }
-
 
248
                }
-
 
249
            }
-
 
250
        };
-
 
251
 
-
 
252
        handler.postDelayed(r, 2000);
264
                }
Línea 253... Línea 265...
253
 
265
            }
254
        /**** CANAL DE NOTIFICACIONES **/
266
        };
255
        createNotificationChannel();
267
 
Línea 411... Línea 423...
411
      //  navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
423
      //  navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
Línea 412... Línea 424...
412
 
424
 
Línea 413... Línea -...
413
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
-
 
414
 
425
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
415
 
426
 
Línea 416... Línea 427...
416
 
427
 
417
        mConnectivityReceiver = new ConnectivityReceiver();
428
        mConnectivityReceiver = new ConnectivityReceiver();
418
        registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
429
        registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
419
 
430
 
420
        IntentFilter intentFilterInternal = new IntentFilter();
431
        IntentFilter intentFilterInternal = new IntentFilter();
Línea 421... Línea 432...
421
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_NOTIFICATION);
432
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_NOTIFICATION);
422
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_TOKEN);
433
       // intentFilterInternal.addAction(Constants.BROADCAST_TYPE_TOKEN);
-
 
434
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_COMMAND);
-
 
435
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_SYNC_TO_SERVER_OR_CHECK_CHANGES);
-
 
436
 
-
 
437
        mInternalReceiver = new InternalReceiver();
Línea 423... Línea 438...
423
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_COMMAND);
438
        //registerReceiver(mInternalReceiver, intentFilterInternal);
Línea -... Línea 439...
-
 
439
        this.registerReceiver(mInternalReceiver, intentFilterInternal);
424
        intentFilterInternal.addAction(Constants.BROADCAST_TYPE_SYNC_TO_SERVER_OR_CHECK_CHANGES);
440
 
425
 
441
     //   FirebaseMessaging.getInstance().setAutoInitEnabled(true);
426
        mInternalReceiver = new InternalReceiver();
442
 
Línea 427... Línea 443...
427
        registerReceiver(mInternalReceiver, intentFilterInternal);
443
 
Línea 940... Línea 956...
940
    @Override
956
    @Override
941
    public void createSyncRecordNewToken(String token)
957
    public void createSyncRecordNewToken(String token)
942
    {
958
    {
Línea 943... Línea 959...
943
 
959
 
944
        Log.e("Token", "Seteo en preferences el token FCM");
960
        Log.e("Token", "Seteo en preferences el token FCM");
945
       // preference.setDeviceToken (token);
961
        preference.setDeviceToken (token);
Línea 946... Línea 962...
946
       // preference.save();
962
        preference.save();
947
 
963
 
948
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
964
        if(!TextUtils.isEmpty(preference.getDeviceUuid())) {
949
            Log.e("Creacion"," del synctoken record");
965
            Log.e("Creacion"," del synctoken record");
Línea 2618... Línea 2634...
2618
 
2634
 
Línea 2619... Línea 2635...
2619
           // Log.e("Ingreso a", "syncToServer"+record.getType()+" data"+record.getData());
2635
           // Log.e("Ingreso a", "syncToServer"+record.getType()+" data"+record.getData());
Línea -... Línea 2636...
-
 
2636
 
2620
 
2637
          //  Log.d(TAG, "SyncRecord ID = " + record.getId() + " Data : "  + record.getData() + " Type= " + record.getType());
2621
          //  Log.d(TAG, "SyncRecord ID = " + record.getId() + " Data : "  + record.getData() + " Type= " + record.getType());
2638
 
2622
 
-
 
Línea 2623... Línea 2639...
2623
            if(record.getType() == Constants.SYNC_ADAPTER_TYPE_DEVICE && !isSyncDevice) {
2639
 
2624
                Log.d(TAG, "Device");
2640
            if(record.getType() == Constants.SYNC_ADAPTER_TYPE_DEVICE && !isSyncDevice) {
2625
                isSyncDevice = true;
2641
                Log.d(TAG, "Device");
Línea 2647... Línea 2663...
2647
 
2663
 
2648
                    Call call = client.newCall(request);
2664
                    Call call = client.newCall(request);
2649
                    call.enqueue(new okhttp3.Callback() {
2665
                    call.enqueue(new okhttp3.Callback() {
2650
                        public void onResponse(Call call, Response response)
2666
                        public void onResponse(Call call, Response response)
2651
                                throws IOException {
-
 
2652
                            isSyncDevice = false;
2667
                                throws IOException {
Línea 2653... Línea 2668...
2653
                            Log.d(TAG, "Response Device :  " +  response.body().toString());
2668
                            Log.d(TAG, "Response Device :  " +  response.body().toString());
2654
 
2669
 
Línea 2655... Línea 2670...
2655
                            processResponseSyncToServer(response.body().string());
2670
                            processResponseSyncToServer(response.body().string(), "device");
2656
                        }
2671
                        }
2657
 
2672
 
Línea 2662... Línea 2677...
2662
                    });
2677
                    });
2663
                } catch (Exception e) {
2678
                } catch (Exception e) {
2664
                }
2679
                }
2665
            }
2680
            }
Línea 2666... Línea 2681...
2666
 
2681
 
2667
            if(record.getType() == Constants.SYNC_ADAPTER_TYPE_FCM && !isSyncToken) {
2682
            if(record.getType() == Constants.SYNC_ADAPTER_TYPE_FCM && !isSyncToken && isSyncDevice) {
2668
                isSyncToken = true;
2683
                isSyncToken = true;
2669
                Log.d(TAG, "FCM");
2684
                Log.d(TAG, "FCM");
Línea 2670... Línea 2685...
2670
                Log.e("Token a Sync",""+record.getData());
2685
                Log.e("Token a Sync",""+record.getData());
Línea 2689... Línea 2704...
2689
                    call.enqueue(new okhttp3.Callback() {
2704
                    call.enqueue(new okhttp3.Callback() {
2690
                        public void onResponse(Call call, Response response)
2705
                        public void onResponse(Call call, Response response)
2691
                                throws IOException {
2706
                                throws IOException {
2692
                            isSyncToken = false;
2707
                            isSyncToken = false;
2693
                            Log.e("Se envio", "Procesando respuesta");
2708
                            Log.e("Se envio", "Procesando respuesta");
2694
                            processResponseSyncToServer(response.body().string());
2709
                            processResponseSyncToServer(response.body().string(), "fcmtoken");
2695
                        }
2710
                        }
Línea 2696... Línea 2711...
2696
 
2711
 
2697
                        public void onFailure(Call call, IOException e) {
2712
                        public void onFailure(Call call, IOException e) {
2698
                            Log.d(TAG, "Error :  " +  e.getMessage());
2713
                            Log.d(TAG, "Error :  " +  e.getMessage());
Línea 2733... Línea 2748...
2733
 
2748
 
2734
                Call call = client.newCall(request);
2749
                Call call = client.newCall(request);
2735
                call.enqueue(new okhttp3.Callback() {
2750
                call.enqueue(new okhttp3.Callback() {
2736
                    public void onResponse(Call call, Response response) throws IOException {
2751
                    public void onResponse(Call call, Response response) throws IOException {
2737
                        isSyncBatch = false;
2752
                        isSyncBatch = false;
2738
                        processResponseServerBatch(response.body().string());
2753
                        processResponseServerBatch(response.body().string(),"");
Línea 2739... Línea 2754...
2739
                    }
2754
                    }
2740
 
2755
 
2741
                    public void onFailure(Call call, IOException e) {
2756
                    public void onFailure(Call call, IOException e) {
Línea 2750... Línea 2765...
2750
        }
2765
        }
Línea 2751... Línea 2766...
2751
 
2766
 
Línea 2752... Línea 2767...
2752
 
2767
 
2753
    }
2768
    }
2754
 
2769
 
2755
    private void processResponseServerBatch(String dataString)
2770
    private void processResponseServerBatch(String dataString, String origen)
Línea 2756... Línea 2771...
2756
    {
2771
    {
Línea 2796... Línea 2811...
2796
                    preference.setPassword(jsonObjectData.getString("password"));
2811
                    preference.setPassword(jsonObjectData.getString("password"));
2797
                    preference.save(this);
2812
                    preference.save(this);
2798
                }
2813
                }
2799
                */
2814
                */
2800
            }
2815
            }
2801
            Log.d(TAG, "SyncID = " + sync_id);
-
 
2802
            if(success && sync_id > 0) {
2816
            if(success && sync_id > 0) {
2803
                Log.d(TAG, "DELETE SYNC RECORD : " + sync_id);
2817
                Log.d(TAG, "DELETE SYNC RECORD : " + sync_id);
2804
                mAppDatabase.getSyncDao().remove(sync_id);
2818
                mAppDatabase.getSyncDao().remove(sync_id);
-
 
2819
 
-
 
2820
                if(origen.equals("device"))
-
 
2821
                {
-
 
2822
                    Log.e("Sync","device exitoso, ahora sigo con TokenFCM");
-
 
2823
                    isSyncDevice=true;
-
 
2824
                    syncToServerOrCheckChanges();
-
 
2825
                }
-
 
2826
                if(origen.equals("fcmtoken")){
-
 
2827
                    Log.e("Token", "termino de sync con exito");
-
 
2828
                }
2805
            }
2829
            }
2806
        } catch (JSONException e) {
2830
        } catch (JSONException e) {
2807
            e.printStackTrace();
2831
            e.printStackTrace();
2808
        }
2832
        }
2809
    }
2833
    }
Línea 2810... Línea 2834...
2810
 
2834
 
2811
    private void processResponseSyncToServer(String dataString)
2835
    private void processResponseSyncToServer(String dataString, String origen)
2812
    {
2836
    {
2813
        boolean success = false;
2837
        boolean success = false;
Línea 2814... Línea 2838...
2814
        long sync_id = 0;
2838
        long sync_id = 0;
2815
 
2839
 
2816
        Log.d(TAG, "processResponseServer = " + dataString);
2840
        Log.d(TAG, "processResponseServer = " + dataString);
2817
        try {
2841
        try {
2818
            JSONObject objJSON = new JSONObject(dataString);
2842
            JSONObject objJSON = new JSONObject(dataString);
2819
            success = objJSON.has("success") ? objJSON.getBoolean("success")  : false;
2843
            success = objJSON.has("success") ? objJSON.getBoolean("success")  : false;
-
 
2844
            if(success  && objJSON.has("data")) {
-
 
2845
                JSONObject jsonObjectData = objJSON.getJSONObject("data");
-
 
2846
                if(origen.equals("device"))
-
 
2847
                {
-
 
2848
                    Log.e("El origen","De la peticion es el dispositivo");
Línea 2820... Línea 2849...
2820
            if(success  && objJSON.has("data")) {
2849
                    isSyncDevice=true;
2821
                JSONObject jsonObjectData = objJSON.getJSONObject("data");
2850
                }
2822
 
2851