Subversion Repositories SmartDukaan

Rev

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

Rev 18497 Rev 19653
Line 890... Line 890...
890
                HttpPost httppost = new HttpPost(apiData.getString("gcm.push.url",null));
890
                HttpPost httppost = new HttpPost(apiData.getString("gcm.push.url",null));
891
                nameValuePairsGcm = new ArrayList<>();
891
                nameValuePairsGcm = new ArrayList<>();
892
                TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
892
                TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
893
                nameValuePairsGcm.add(new BasicNameValuePair("gcm_regid",regId));
893
                nameValuePairsGcm.add(new BasicNameValuePair("gcm_regid",regId));
894
                nameValuePairsGcm.add(new BasicNameValuePair("imeinumber",telephonyManager.getDeviceId()));
894
                nameValuePairsGcm.add(new BasicNameValuePair("imeinumber",telephonyManager.getDeviceId()));
895
                nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id",null)));
895
                nameValuePairsGcm.add(new BasicNameValuePair("user_id",userData.getString("id", null)));
896
                nameValuePairsGcm.add(new BasicNameValuePair("device_message",arg0[0]));
896
                nameValuePairsGcm.add(new BasicNameValuePair("device_message",arg0[0]));
-
 
897
                nameValuePairsGcm.add(new BasicNameValuePair("androidid",UtilityFunctions.androidId(LoginActivity.this)));
897
                httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
898
                httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
898
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairsGcm));
899
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairsGcm));
899
                HttpResponse response = httpclient.execute(httppost);
900
                HttpResponse response = httpclient.execute(httppost);
900
                HttpEntity entity = response.getEntity();
901
                HttpEntity entity = response.getEntity();
901
                int status = response.getStatusLine().getStatusCode();
902
                int status = response.getStatusLine().getStatusCode();
Line 1012... Line 1013...
1012
            super.onPostExecute(result);
1013
            super.onPostExecute(result);
1013
            Log.d("Notification Opened","Notication opened and login page");
1014
            Log.d("Notification Opened","Notication opened and login page");
1014
        }
1015
        }
1015
    }
1016
    }
1016
 
1017
 
1017
  /*  @Override
-
 
1018
    protected void onRestart() {
-
 
1019
        super.onRestart();
-
 
1020
    }
-
 
1021
    */
-
 
1022
    class pushApkData extends AsyncTask<ArrayList<NameValuePair>, Integer, String> {
1018
    class pushApkData extends AsyncTask<ArrayList<NameValuePair>, Integer, String> {
1023
 
1019
 
1024
        @Override
1020
        @Override
1025
        protected void onPreExecute() {
1021
        protected void onPreExecute() {
1026
            super.onPreExecute();
1022
            super.onPreExecute();
Line 1035... Line 1031...
1035
                httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
1031
                httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
1036
                HttpResponse response = httpclient.execute(httppost);
1032
                HttpResponse response = httpclient.execute(httppost);
1037
                HttpEntity entity = response.getEntity();
1033
                HttpEntity entity = response.getEntity();
1038
                int status = response.getStatusLine().getStatusCode();
1034
                int status = response.getStatusLine().getStatusCode();
1039
                if(status == 200){
1035
                if(status == 200){
1040
/*
-
 
1041
                    apkDataEditor.putString("checkId",userData.getString("id",""));
-
 
1042
                    apkDataEditor.commit();
-
 
1043
*/
-
 
1044
                    return "success";
1036
                    return "success";
1045
                } else {
1037
                } else {
1046
                    return "failure";
1038
                    return "failure";
1047
                }
1039
                }
1048
            } catch (Exception e) {
1040
            } catch (Exception e) {