Subversion Repositories SmartDukaan

Rev

Rev 14792 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14792 Rev 14991
Line 11... Line 11...
11
import android.net.ConnectivityManager;
11
import android.net.ConnectivityManager;
12
import android.net.Uri;
12
import android.net.Uri;
13
import android.os.AsyncTask;
13
import android.os.AsyncTask;
14
import android.os.Bundle;
14
import android.os.Bundle;
15
import android.app.Fragment;
15
import android.app.Fragment;
-
 
16
import android.util.Base64;
16
import android.util.Log;
17
import android.util.Log;
17
import android.view.KeyEvent;
18
import android.view.KeyEvent;
18
import android.view.LayoutInflater;
19
import android.view.LayoutInflater;
19
import android.view.View;
20
import android.view.View;
20
import android.view.ViewGroup;
21
import android.view.ViewGroup;
21
import android.webkit.CookieManager;
22
import android.webkit.CookieManager;
-
 
23
import android.webkit.CookieSyncManager;
22
import android.webkit.HttpAuthHandler;
24
import android.webkit.HttpAuthHandler;
-
 
25
import android.webkit.JavascriptInterface;
23
import android.webkit.WebView;
26
import android.webkit.WebView;
24
import android.webkit.WebViewClient;
27
import android.webkit.WebViewClient;
-
 
28
import android.widget.Button;
-
 
29
import android.widget.Toast;
25
 
30
 
-
 
31
import com.facebook.Session;
26
import com.google.android.gms.analytics.GoogleAnalytics;
32
import com.google.android.gms.analytics.GoogleAnalytics;
27
import com.google.android.gms.analytics.HitBuilders;
33
import com.google.android.gms.analytics.HitBuilders;
28
import com.google.android.gms.analytics.Tracker;
34
import com.google.android.gms.analytics.Tracker;
-
 
35
import com.google.android.gms.auth.GoogleAuthUtil;
-
 
36
import com.google.android.gms.common.ConnectionResult;
-
 
37
import com.google.android.gms.common.Scopes;
-
 
38
import com.google.android.gms.common.api.GoogleApiClient;
-
 
39
import com.google.android.gms.plus.Plus;
29
import com.mixpanel.android.mpmetrics.MixpanelAPI;
40
import com.mixpanel.android.mpmetrics.MixpanelAPI;
30
import com.saholic.profittill.Constants.ProfitTillConstants;
41
import com.saholic.profittill.Constants.ProfitTillConstants;
31
import com.saholic.profittill.R;
42
import com.saholic.profittill.R;
-
 
43
import com.saholic.profittill.Utils.UtilityFunctions;
32
import com.testin.agent.TestinAgent;
44
import com.testin.agent.TestinAgent;
33
 
45
 
-
 
46
import org.apache.http.HttpEntity;
34
import org.apache.http.HttpResponse;
47
import org.apache.http.HttpResponse;
35
import org.apache.http.NameValuePair;
48
import org.apache.http.NameValuePair;
36
import org.apache.http.client.ClientProtocolException;
49
import org.apache.http.client.ClientProtocolException;
37
import org.apache.http.client.HttpClient;
50
import org.apache.http.client.HttpClient;
38
import org.apache.http.client.entity.UrlEncodedFormEntity;
51
import org.apache.http.client.entity.UrlEncodedFormEntity;
39
import org.apache.http.client.methods.HttpPost;
52
import org.apache.http.client.methods.HttpPost;
40
import org.apache.http.entity.StringEntity;
53
import org.apache.http.entity.StringEntity;
41
import org.apache.http.impl.client.DefaultHttpClient;
54
import org.apache.http.impl.client.DefaultHttpClient;
42
import org.apache.http.message.BasicNameValuePair;
55
import org.apache.http.message.BasicNameValuePair;
-
 
56
import org.apache.http.util.EntityUtils;
43
import org.json.JSONArray;
57
import org.json.JSONArray;
44
import org.json.JSONException;
58
import org.json.JSONException;
45
import org.json.JSONObject;
59
import org.json.JSONObject;
46
 
60
 
47
import java.io.IOException;
61
import java.io.IOException;
48
import java.text.SimpleDateFormat;
62
import java.text.SimpleDateFormat;
49
import java.util.ArrayList;
63
import java.util.ArrayList;
50
import java.util.Date;
64
import java.util.Date;
-
 
65
import java.util.HashMap;
-
 
66
import java.util.List;
-
 
67
import java.util.Map;
51
 
68
 
52
public class MyWallet extends Fragment {
69
public class MyWallet extends Fragment {
53
    WebView myWalletWebView;
70
    WebView myWalletWebView;
54
    SharedPreferences userData;
71
    SharedPreferences userData;
55
    SharedPreferences apiData;
72
    SharedPreferences apiData;
56
    SharedPreferences.Editor userDataEditor;
73
    SharedPreferences.Editor userDataEditor;
57
    SharedPreferences.Editor apiSettingsEditor;
74
    SharedPreferences.Editor apiSettingsEditor;
-
 
75
    String saholicUrl;
-
 
76
    JSONObject jSaholic;
-
 
77
    JSONArray jsArraySaholic;
-
 
78
    int pageRedirect=0;
-
 
79
    boolean displayActionBar;
-
 
80
    ArrayList<NameValuePair> nameValuePairsRawHtml;
58
 
-
 
59
    public MyWallet() {
81
    public MyWallet() {
60
 
82
 
61
    }
83
    }
62
 
84
 
63
 
85
 
Line 69... Line 91...
69
        TestinAgent.init(getActivity());
91
        TestinAgent.init(getActivity());
70
        MixpanelAPI mixpanel = MixpanelAPI.getInstance(getActivity(), ProfitTillConstants.MIX_PANEL_TOKEN);
92
        MixpanelAPI mixpanel = MixpanelAPI.getInstance(getActivity(), ProfitTillConstants.MIX_PANEL_TOKEN);
71
        userData = getActivity().getSharedPreferences("User_Data", Context.MODE_PRIVATE);
93
        userData = getActivity().getSharedPreferences("User_Data", Context.MODE_PRIVATE);
72
        apiData = getActivity().getSharedPreferences("API_Data", Context.MODE_PRIVATE);
94
        apiData = getActivity().getSharedPreferences("API_Data", Context.MODE_PRIVATE);
73
        userDataEditor = userData.edit();
95
        userDataEditor = userData.edit();
-
 
96
 
74
        apiSettingsEditor = apiData.edit();
97
        apiSettingsEditor = apiData.edit();
75
        TestinAgent.setUserInfo(userData.getString("id", ""));
98
        TestinAgent.setUserInfo(userData.getString("id", ""));
76
        String url = apiData.getString("mywallet.url",null);
99
        String url = apiData.getString("mywallet.url",null);
77
        String id = userData.getString("id",null);
100
        String id = userData.getString("id",null);
78
        String landingUrl = url + "?user_id=" + id;
101
        String landingUrl = url + "?user_id=" + id;
Line 89... Line 112...
89
            myWalletWebView = (WebView) rootView.findViewById(R.id.myWalletWebView);
112
            myWalletWebView = (WebView) rootView.findViewById(R.id.myWalletWebView);
90
            myWalletWebView.setClickable(true);
113
            myWalletWebView.setClickable(true);
91
            myWalletWebView.setFocusableInTouchMode(true);
114
            myWalletWebView.setFocusableInTouchMode(true);
92
            myWalletWebView.getSettings().setDomStorageEnabled(true);
115
            myWalletWebView.getSettings().setDomStorageEnabled(true);
93
            myWalletWebView.getSettings().setJavaScriptEnabled(true);
116
            myWalletWebView.getSettings().setJavaScriptEnabled(true);
-
 
117
            myWalletWebView.addJavascriptInterface(new javascriptInterface(getActivity()), "HTMLOUT");
-
 
118
            if(Uri.parse(landingUrl).getHost().contains("api.profittill")) {
-
 
119
                userDataEditor.putString("saholic.data", UtilityFunctions.clearCookiesNew(landingUrl,getActivity())).commit();
-
 
120
            }
94
            myWalletWebView.loadUrl(landingUrl);
121
            myWalletWebView.loadUrl(landingUrl);
95
            //myWalletWebView.reload();
-
 
96
 
-
 
97
            myWalletWebView.setWebViewClient(webViewClient);
122
            myWalletWebView.setWebViewClient(webViewClient);
98
        }else{
123
        }else{
99
            SearchFragment nextFrag= new SearchFragment();
124
            SearchFragment nextFrag= new SearchFragment();
100
            Bundle args = new Bundle();
125
            Bundle args = new Bundle();
101
            args.putString("finishingurl", landingUrl);
126
            args.putString("finishingurl", landingUrl);
Line 114... Line 139...
114
    public void onViewCreated(View view, Bundle savedInstanceState) {
139
    public void onViewCreated(View view, Bundle savedInstanceState) {
115
        super.onViewCreated(view, savedInstanceState);
140
        super.onViewCreated(view, savedInstanceState);
116
    }
141
    }
117
 
142
 
118
    JSONObject obj;
143
    JSONObject obj;
-
 
144
    public void getDisplayActionBar(String url) throws Exception{
-
 
145
        String snapdealConfirmation = apiData.getString("snapdeal.order.success.url",null);
-
 
146
        String flipkartConfirmation = apiData.getString("flipkart.order.success.url",null);
-
 
147
        String amazonConfirmation = apiData.getString("amazon.order.success.url",null);
-
 
148
        String amazonThankYouConfirmation = apiData.getString("amazon.order.success.thankyou.url",null);
-
 
149
        String saholicConfirmation = apiData.getString("saholic.order.success.url",null);
-
 
150
        if(url.contains(snapdealConfirmation) || url.contains(flipkartConfirmation) || url.contains(amazonConfirmation) || url.contains(amazonThankYouConfirmation) || url.contains(saholicConfirmation)){
-
 
151
            displayActionBar=true;
-
 
152
            String storeID = getStoreId(url);
-
 
153
            if(storeID==null){
-
 
154
                Log.e("Deals Page Activity", "Null value returned for storeID");
-
 
155
            }
-
 
156
            else{
-
 
157
                nameValuePairsRawHtml=new ArrayList<NameValuePair>();
-
 
158
                nameValuePairsRawHtml.add(new BasicNameValuePair("user_id",userData.getString("id",null)));
-
 
159
                nameValuePairsRawHtml.add(new BasicNameValuePair("store_id",storeID));
-
 
160
                nameValuePairsRawHtml.add(new BasicNameValuePair("order_url",url));
-
 
161
                nameValuePairsRawHtml.add(new BasicNameValuePair("sub_tag",userData.getString("subtag",null)));
-
 
162
            }
-
 
163
        }
-
 
164
        else{
-
 
165
            displayActionBar = false;
-
 
166
        }
-
 
167
        return;
-
 
168
    }
-
 
169
 
-
 
170
 
-
 
171
    public String getStoreId(String url){
-
 
172
        if(url.contains("snapdeal")){
-
 
173
            pageRedirect=Integer.parseInt(apiData.getString("pageredirect.snapdeal","0"));
-
 
174
            return apiData.getString("store.code.snapdeal",null);
-
 
175
        }
-
 
176
        else if(url.contains("flipkart")){
-
 
177
            pageRedirect=Integer.parseInt(apiData.getString("pageredirect.flipkart","0"));
-
 
178
            return apiData.getString("store.code.flipkart",null);
-
 
179
        }
-
 
180
        else if(url.contains("amazon")){
-
 
181
            pageRedirect=Integer.parseInt(apiData.getString("pageredirect.amazon","0"));
-
 
182
            return apiData.getString("store.code.amazon",null);
-
 
183
        }
-
 
184
        else if(url.contains("saholic")){
-
 
185
            return apiData.getString("store.code.spice",null);
-
 
186
        }
-
 
187
        return null;
-
 
188
    }
-
 
189
 
119
    public class WebClientClass extends WebViewClient {
190
    public class WebClientClass extends WebViewClient {
120
        ProgressDialog pd = null;
191
        ProgressDialog pd = null;
121
 
192
 
122
        @Override
193
        @Override
123
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
194
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
124
            super.onPageStarted(view, url, favicon);
195
            super.onPageStarted(view, url, favicon);
-
 
196
            CookieSyncManager.createInstance(getActivity());
-
 
197
            CookieManager cookieManager = CookieManager.getInstance();
-
 
198
            cookieManager.setCookie(url, "token="+userData.getString("token",""));
-
 
199
          try {
-
 
200
                getDisplayActionBar(url);
-
 
201
            }catch (Exception e){
-
 
202
                e.printStackTrace();
-
 
203
            }
-
 
204
        }
-
 
205
        @Override
-
 
206
        public void onPageFinished(WebView view, String url) {
-
 
207
            super.onPageFinished(view, url);
125
            obj = new JSONObject();
208
            obj = new JSONObject();
126
            /*CookieManager cookieManager = CookieManager.getInstance();
-
 
127
            String cookiestring = cookieManager.getCookie(url);
-
 
128
            Log.d("Cookies setting ","Cookies " + cookiestring);*/
-
 
129
            //cookieManager.removeAllCookie();
-
 
130
            try {
209
            try {
-
 
210
                if(Uri.parse(url).getHost().contains("saholic") && apiData.getString("saholic.data","false").equalsIgnoreCase("true")){
-
 
211
                    saholicUrl=url;
-
 
212
                    view.loadUrl("javascript:window.HTMLOUT.saholicHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
-
 
213
                }else {
131
                JSONObject j = new JSONObject();
214
                    JSONObject j = new JSONObject();
132
                JSONArray jsArray = new JSONArray();
215
                    JSONArray jsArray = new JSONArray();
133
                j.put("url",url);
216
                    j.put("url", url);
134
                j.put("user_id",userData.getString("id",null));
217
                    j.put("user_id", userData.getString("id", null));
135
                j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
218
                    j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
136
                jsArray.put(j);
219
                    jsArray.put(j);
137
                obj.put("pushdata",jsArray);
220
                    obj.put("pushdata", jsArray);
-
 
221
                    new pushData().execute();
-
 
222
                }
138
            } catch (JSONException e) {
223
            } catch (JSONException e) {
139
                e.printStackTrace();
224
                e.printStackTrace();
140
            }
225
            }
141
            new pushData().execute();
-
 
142
 
226
 
143
        }
227
            if(displayActionBar){
-
 
228
                view.loadUrl("javascript:window.HTMLOUT.flipkartHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
144
        @Override
229
            }
145
        public void onPageFinished(WebView view, String url) {
-
 
146
            view.setOnKeyListener(new View.OnKeyListener()
230
            view.setOnKeyListener(new View.OnKeyListener()
147
            {
231
            {
148
                @Override
232
                @Override
149
                public boolean onKey(View v, int keyCode, KeyEvent event)
233
                public boolean onKey(View v, int keyCode, KeyEvent event)
150
                {
234
                {
Line 170... Line 254...
170
                    }
254
                    }
171
 
255
 
172
                    return false;
256
                    return false;
173
                }
257
                }
174
            });
258
            });
175
            super.onPageFinished(view, url);
-
 
-
 
259
 
176
        }
260
        }
177
        @Override
261
        @Override
178
        public void onReceivedHttpAuthRequest(WebView view,
262
        public void onReceivedHttpAuthRequest(WebView view,
179
                                              HttpAuthHandler handler, String host, String realm) {
263
                                              HttpAuthHandler handler, String host, String realm) {
180
 
264
 
Line 193... Line 277...
193
                    .replace(R.id.frame_container, nextFrag)
277
                    .replace(R.id.frame_container, nextFrag)
194
                    .addToBackStack(null)
278
                    .addToBackStack(null)
195
                    .commit();
279
                    .commit();
196
        }
280
        }
197
 
281
 
-
 
282
      /*  @Override
-
 
283
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
-
 
284
            Map<String, String> headers1 = new HashMap<>();
-
 
285
            headers1.put("token", userData.getString("token",""));
-
 
286
            Log.d("Token","Token " + userData.getString("token",""));
-
 
287
            view.loadUrl(url,headers1);
-
 
288
            return true;
-
 
289
        }*/
198
    }
290
    }
199
 
291
 
200
    @Override
292
    @Override
201
    public void onResume() {
293
    public void onResume() {
202
        super.onResume();
294
        super.onResume();
Line 204... Line 296...
204
        getView().requestFocus();
296
        getView().requestFocus();
205
        getView().setOnKeyListener(new View.OnKeyListener() {
297
        getView().setOnKeyListener(new View.OnKeyListener() {
206
            @Override
298
            @Override
207
            public boolean onKey(View v, int keyCode, KeyEvent event) {
299
            public boolean onKey(View v, int keyCode, KeyEvent event) {
208
 
300
 
209
                if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK){
301
                if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
210
                    Intent i = new Intent(getActivity(), MainActivity.class);
302
                    Intent i = new Intent(getActivity(), MainActivity.class);
211
                    i.putExtra("displayView", "0");
303
                    i.putExtra("displayView", "0");
212
                    startActivity(i);
304
                    startActivity(i);
213
                    return true;
305
                    return true;
214
 
306
 
Line 281... Line 373...
281
                        connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.DISCONNECTED  ) {
373
                        connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.DISCONNECTED  ) {
282
            return false;
374
            return false;
283
        }
375
        }
284
        return false;
376
        return false;
285
    }
377
    }
-
 
378
    class checkGateWayProblem extends AsyncTask<String, Integer, String> {
-
 
379
 
-
 
380
        // JSONObject jobj1;
-
 
381
 
-
 
382
        @Override
-
 
383
        protected void onPreExecute() {
-
 
384
            super.onPreExecute();
-
 
385
        }
-
 
386
 
-
 
387
        @Override
-
 
388
        protected String doInBackground(String... arg0) {
-
 
389
            HttpClient httpclient = new DefaultHttpClient();
-
 
390
            try {
-
 
391
                //jobj1 = new JSONObject();
-
 
392
                HttpPost httppost = new HttpPost(arg0[0]);
-
 
393
                final String basicAuth = "Basic " + Base64.encodeToString("dtr:dtr18Feb2015".getBytes(), Base64.NO_WRAP);
-
 
394
                httppost.setHeader("Authorization", basicAuth);
-
 
395
                HttpResponse response = httpclient.execute(httppost);
-
 
396
                int status = response.getStatusLine().getStatusCode();
-
 
397
 
-
 
398
                jsArraySaholic = new JSONArray();
-
 
399
                jSaholic.put("url", arg0[0]);
-
 
400
 
-
 
401
                jSaholic.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-
 
402
                jSaholic.put("httpstatus", status);
-
 
403
                jSaholic.put("cookies", CookieManager.getInstance().getCookie(arg0[0]));
-
 
404
                jsArraySaholic.put(jSaholic);
-
 
405
                obj.put("pushdata", jsArraySaholic);
-
 
406
                Log.d("status " ,"Status in checkGatewayProbelm " + status);
-
 
407
                if(status == 200){
-
 
408
                    return "success";
-
 
409
                } else {
-
 
410
                    return "failure";
-
 
411
                }
-
 
412
 
-
 
413
            } catch (ClientProtocolException e) {
-
 
414
                return "failure";
-
 
415
            } catch (IOException e) {
-
 
416
                return "failure";
-
 
417
            }catch (JSONException e){
-
 
418
                return "failure";
-
 
419
            }
-
 
420
        }
-
 
421
 
-
 
422
        @Override
-
 
423
        protected void onPostExecute(String result) {
-
 
424
            super.onPostExecute(result);
-
 
425
            new pushData1().execute(obj);
-
 
426
        }
-
 
427
    }
-
 
428
    class javascriptInterface {
-
 
429
 
-
 
430
        Context mContext;
-
 
431
 
-
 
432
        /**
-
 
433
         * Instantiate the interface and set the context
-
 
434
         */
-
 
435
        public javascriptInterface(Context c) {
-
 
436
            mContext = c;
-
 
437
        }
-
 
438
 
-
 
439
        @JavascriptInterface
-
 
440
        public void saholicHTML(String html) {
-
 
441
 
-
 
442
            try {
-
 
443
                obj = new JSONObject();
-
 
444
                jSaholic = new JSONObject();
-
 
445
                jSaholic.put("html", UtilityFunctions.compress(html));
-
 
446
                jSaholic.put("zip", "1");
-
 
447
                jSaholic.put("user_id", userData.getString("id", null));
-
 
448
            } catch (Exception e) {
-
 
449
 
-
 
450
            }
-
 
451
            new checkGateWayProblem().execute(saholicUrl);
-
 
452
        }
-
 
453
        @JavascriptInterface
-
 
454
        public void flipkartHTML(String html) {
-
 
455
            nameValuePairsRawHtml.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(html)));
-
 
456
            nameValuePairsRawHtml.add(new BasicNameValuePair("zip","1"));
-
 
457
            new loadData().execute(nameValuePairsRawHtml);
-
 
458
        }
-
 
459
    }
-
 
460
 
-
 
461
    class pushData1 extends AsyncTask<JSONObject, Integer, String> {
-
 
462
 
-
 
463
        @Override
-
 
464
        protected void onPreExecute() {
-
 
465
            super.onPreExecute();
-
 
466
        }
-
 
467
 
-
 
468
        @Override
-
 
469
        protected String doInBackground(JSONObject... arg0) {
-
 
470
            HttpClient httpclient = new DefaultHttpClient();
-
 
471
            try {
-
 
472
                ArrayList<NameValuePair> nameValuePairs = new ArrayList<>();
-
 
473
                nameValuePairs.add(new BasicNameValuePair("pushdata",arg0[0].toString()));
-
 
474
                HttpPost httppost = new HttpPost(apiData.getString("url.push.api",null));
-
 
475
                final String basicAuth = "Basic " + Base64.encodeToString("dtr:dtr18Feb2015".getBytes(), Base64.NO_WRAP);
-
 
476
                httppost.setHeader("Authorization", basicAuth);
-
 
477
 
-
 
478
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
-
 
479
                System.out.println("JSON object in push Data 1 " + arg0[0].toString());
-
 
480
                StringEntity se = new StringEntity(arg0[0].toString());
-
 
481
                HttpResponse response = httpclient.execute(httppost);
-
 
482
                int status = response.getStatusLine().getStatusCode();
-
 
483
 
-
 
484
                if(status == 200){
-
 
485
                    return "success";
-
 
486
                } else {
-
 
487
                    return "failure";
-
 
488
                }
-
 
489
 
-
 
490
            } catch (ClientProtocolException e) {
-
 
491
                return "failure";
-
 
492
            } catch (IOException e) {
-
 
493
                return "failure";
-
 
494
            }
-
 
495
        }
-
 
496
 
-
 
497
        @Override
-
 
498
        protected void onPostExecute(String result) {
-
 
499
            super.onPostExecute(result);
-
 
500
        }
-
 
501
    }
-
 
502
    class loadData extends AsyncTask<List<NameValuePair>, Integer, JSONObject> {
-
 
503
 
-
 
504
        @Override
-
 
505
        protected void onPreExecute() {
-
 
506
            super.onPreExecute();
-
 
507
        }
286
 
508
 
-
 
509
        @Override
-
 
510
        protected JSONObject doInBackground(List<NameValuePair>... orderDetail) {
-
 
511
 
-
 
512
 
-
 
513
            try {
-
 
514
                HttpClient httpclient = new DefaultHttpClient();
-
 
515
                HttpPost httppost = new HttpPost(apiData.getString("orderpagehtml.push.api", null));
-
 
516
                httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
-
 
517
 
-
 
518
                httppost.setEntity(new UrlEncodedFormEntity(orderDetail[0]));
-
 
519
                HttpResponse response = httpclient.execute(httppost);
-
 
520
                HttpEntity entity = response.getEntity();
-
 
521
                String getJSON = EntityUtils.toString(entity);
-
 
522
                if(getJSON==null){
-
 
523
                    return null;
-
 
524
                }else {
-
 
525
                    JSONObject jObjGmail = new JSONObject(getJSON);
-
 
526
                    return jObjGmail;
-
 
527
                }
-
 
528
            } catch (Exception e) {
-
 
529
                return null;
-
 
530
            }
-
 
531
        }
-
 
532
 
-
 
533
 
-
 
534
        @Override
-
 
535
        protected void onPostExecute(JSONObject result) {
-
 
536
            super.onPostExecute(result);
-
 
537
        }
-
 
538
    }
287
 
539
 
288
}
540
}