| 14792 |
manas |
1 |
package com.saholic.profittill.main;
|
|
|
2 |
|
|
|
3 |
import android.app.AlertDialog;
|
| 16278 |
manas |
4 |
import android.app.ProgressDialog;
|
| 14792 |
manas |
5 |
import android.content.Context;
|
|
|
6 |
import android.content.DialogInterface;
|
|
|
7 |
import android.content.Intent;
|
|
|
8 |
import android.content.SharedPreferences;
|
|
|
9 |
import android.net.ConnectivityManager;
|
| 18082 |
manas |
10 |
import android.net.Uri;
|
| 14792 |
manas |
11 |
import android.os.AsyncTask;
|
|
|
12 |
import android.support.v7.app.ActionBarActivity;
|
|
|
13 |
import android.os.Bundle;
|
| 15977 |
manas |
14 |
import android.text.SpannableString;
|
|
|
15 |
import android.text.style.UnderlineSpan;
|
| 14792 |
manas |
16 |
import android.util.Log;
|
|
|
17 |
import android.view.Menu;
|
|
|
18 |
import android.view.MenuItem;
|
|
|
19 |
import android.view.View;
|
|
|
20 |
import android.widget.Button;
|
|
|
21 |
import android.widget.EditText;
|
|
|
22 |
import android.widget.TextView;
|
|
|
23 |
import android.widget.Toast;
|
|
|
24 |
|
|
|
25 |
import com.facebook.Session;
|
|
|
26 |
import com.google.android.gms.analytics.HitBuilders;
|
|
|
27 |
import com.google.android.gms.analytics.Tracker;
|
|
|
28 |
import com.google.android.gms.common.ConnectionResult;
|
|
|
29 |
import com.google.android.gms.common.api.GoogleApiClient;
|
|
|
30 |
import com.google.android.gms.plus.Plus;
|
|
|
31 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
|
|
32 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
|
|
33 |
import com.saholic.profittill.R;
|
| 16278 |
manas |
34 |
import com.saholic.profittill.Utils.AnalyticsUtility;
|
| 18082 |
manas |
35 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
| 16278 |
manas |
36 |
import com.saholic.profittill.Volley.Analytics;
|
|
|
37 |
import com.saholic.profittill.Volley.AnalyticsErrorResponse;
|
|
|
38 |
import com.saholic.profittill.Volley.AnalyticsJsonResponse;
|
| 14792 |
manas |
39 |
import com.testin.agent.TestinAgent;
|
|
|
40 |
|
|
|
41 |
import org.apache.http.HttpEntity;
|
|
|
42 |
import org.apache.http.HttpResponse;
|
|
|
43 |
import org.apache.http.NameValuePair;
|
|
|
44 |
import org.apache.http.client.ClientProtocolException;
|
|
|
45 |
import org.apache.http.client.HttpClient;
|
|
|
46 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
|
47 |
import org.apache.http.client.methods.HttpPost;
|
|
|
48 |
import org.apache.http.impl.client.DefaultHttpClient;
|
|
|
49 |
import org.apache.http.message.BasicNameValuePair;
|
|
|
50 |
import org.apache.http.util.EntityUtils;
|
|
|
51 |
import org.json.JSONException;
|
|
|
52 |
import org.json.JSONObject;
|
|
|
53 |
|
|
|
54 |
import java.io.IOException;
|
|
|
55 |
import java.text.SimpleDateFormat;
|
|
|
56 |
import java.util.ArrayList;
|
|
|
57 |
import java.util.Date;
|
|
|
58 |
|
|
|
59 |
public class MobileNumber extends ActionBarActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
|
|
60 |
SharedPreferences userData;
|
|
|
61 |
SharedPreferences apiData;
|
|
|
62 |
SharedPreferences.Editor userDataEditor;
|
|
|
63 |
SharedPreferences.Editor apiSettingsEditor;
|
|
|
64 |
EditText phoneNumberFirstTime;
|
|
|
65 |
TextView skipMobileNumber;
|
|
|
66 |
Button phoneNumberFirstTimeButton;
|
|
|
67 |
boolean glogout;
|
|
|
68 |
MixpanelAPI mixpanel;
|
|
|
69 |
String type1;
|
| 18082 |
manas |
70 |
ArrayList<NameValuePair> nameValuePairsGcm;
|
| 14792 |
manas |
71 |
public GoogleApiClient mGoogleApiClient;
|
|
|
72 |
@Override
|
|
|
73 |
protected void onCreate(Bundle savedInstanceState) {
|
|
|
74 |
super.onCreate(savedInstanceState);
|
|
|
75 |
setContentView(R.layout.activity_mobile_number);
|
|
|
76 |
TestinAgent.init(this);
|
|
|
77 |
getSupportActionBar().hide();
|
|
|
78 |
mixpanel= MixpanelAPI.getInstance(getApplicationContext(), ProfitTillConstants.MIX_PANEL_TOKEN);
|
|
|
79 |
userData = getApplicationContext().getSharedPreferences("User_Data", Context.MODE_PRIVATE);
|
|
|
80 |
apiData = getApplicationContext().getSharedPreferences("API_Data", Context.MODE_PRIVATE);
|
|
|
81 |
userDataEditor = userData.edit();
|
|
|
82 |
apiSettingsEditor = apiData.edit();
|
|
|
83 |
TestinAgent.setUserInfo(userData.getString("id", ""));
|
|
|
84 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
|
|
85 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
|
|
86 |
t.setScreenName("First Time Mobile Entered Screen");
|
|
|
87 |
t.send(new HitBuilders.ScreenViewBuilder().build());
|
| 16278 |
manas |
88 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
|
|
89 |
AnalyticsUtility.getAnalyticsRequest(MobileNumber.this, userData.getString("id", ""), "Screen", "Mobile Number", "Mobile Number Entering"),
|
|
|
90 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
|
|
91 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MobileNumber.this);
|
| 14792 |
manas |
92 |
|
|
|
93 |
type1 = userData.getString("type",null);
|
|
|
94 |
|
|
|
95 |
if(type1!=null && type1.equalsIgnoreCase("google")) {
|
|
|
96 |
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
|
|
97 |
.addConnectionCallbacks(this)
|
|
|
98 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
|
|
99 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
|
|
100 |
mGoogleApiClient.connect();
|
|
|
101 |
}
|
| 18082 |
manas |
102 |
if(getIntent().getAction()=="31"){
|
|
|
103 |
String emailURL= String.valueOf(getIntent().getData());
|
|
|
104 |
Uri url = Uri.parse(emailURL);
|
|
|
105 |
String campaignId = url.getQueryParameter("campaign");
|
|
|
106 |
if(url.getQueryParameter("intent_type").equalsIgnoreCase("url")) {
|
|
|
107 |
t.send(new HitBuilders.EventBuilder()
|
|
|
108 |
.setCategory("Message/Email")
|
|
|
109 |
.setAction("Message/Email Opened For User Id " + UtilityFunctions.campaignUserId(url))
|
|
|
110 |
.setLabel("Campaign Id " + campaignId)
|
|
|
111 |
.build());
|
|
|
112 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
|
|
113 |
AnalyticsUtility.getAnalyticsRequest(MobileNumber.this, UtilityFunctions.campaignUserId(url), "Message", "Message Opened Mobile", campaignId),
|
|
|
114 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
|
|
115 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MobileNumber.this);
|
|
|
116 |
nameValuePairsGcm = new ArrayList<>();
|
|
|
117 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", UtilityFunctions.campaignUserId(url)));
|
|
|
118 |
nameValuePairsGcm.add(new BasicNameValuePair("cid", campaignId));
|
|
|
119 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
|
|
120 |
nameValuePairsGcm.add(new BasicNameValuePair("result", "message_opened_mobile"));
|
|
|
121 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
|
|
122 |
}else{
|
|
|
123 |
nameValuePairsGcm = new ArrayList<>();
|
|
|
124 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", userData.getString("id","")));
|
|
|
125 |
nameValuePairsGcm.add(new BasicNameValuePair("cid", campaignId));
|
|
|
126 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
|
|
127 |
nameValuePairsGcm.add(new BasicNameValuePair("result", "message_opened_mobile"));
|
|
|
128 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
|
|
129 |
}
|
|
|
130 |
}
|
| 14792 |
manas |
131 |
phoneNumberFirstTime=(EditText)findViewById(R.id.phoneNumberFirstTime);
|
|
|
132 |
skipMobileNumber = (TextView)findViewById(R.id.skipMobileNumber);
|
|
|
133 |
phoneNumberFirstTimeButton=(Button)findViewById(R.id.phoneNumberFirstTimeButton);
|
| 15977 |
manas |
134 |
SpannableString content = new SpannableString(skipMobileNumber.getText().toString());
|
|
|
135 |
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
|
|
136 |
skipMobileNumber.setText(content);
|
| 14792 |
manas |
137 |
|
|
|
138 |
skipMobileNumber.setOnClickListener(new View.OnClickListener() {
|
|
|
139 |
@Override
|
|
|
140 |
public void onClick(View v) {
|
|
|
141 |
|
|
|
142 |
JSONObject props = new JSONObject();
|
|
|
143 |
try {
|
| 16278 |
manas |
144 |
mixpanel.identify(userData.getString("id", null));
|
| 14792 |
manas |
145 |
props.put("Screen", "Mobile Verification");
|
| 16278 |
manas |
146 |
mixpanel.track("First Time Mobile Number Skipped", props);
|
| 14792 |
manas |
147 |
} catch (JSONException e) {
|
|
|
148 |
e.printStackTrace();
|
|
|
149 |
}
|
|
|
150 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
|
|
151 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
|
|
152 |
t.send(new HitBuilders.EventBuilder()
|
|
|
153 |
.setCategory("First Time Mobile Entered ")
|
|
|
154 |
.setAction("Number not entered")
|
|
|
155 |
.setLabel("First Time Mobile Not entered")
|
|
|
156 |
.build());
|
|
|
157 |
|
| 16278 |
manas |
158 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
|
|
159 |
AnalyticsUtility.getAnalyticsRequest(MobileNumber.this, userData.getString("id", ""), "Clicks", "Mobile Number", "Mobile Number Skipped"),
|
|
|
160 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
|
|
161 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MobileNumber.this);
|
|
|
162 |
|
|
|
163 |
Intent i = new Intent(MobileNumber.this, MainActivity.class);
|
|
|
164 |
i.putExtra("displayView", "7");
|
| 14792 |
manas |
165 |
startActivity(i);
|
|
|
166 |
}
|
|
|
167 |
});
|
| 16278 |
manas |
168 |
|
| 14792 |
manas |
169 |
phoneNumberFirstTimeButton.setOnClickListener(new View.OnClickListener() {
|
|
|
170 |
@Override
|
|
|
171 |
public void onClick(View v) {
|
|
|
172 |
if(phoneNumberFirstTime.getText().toString().length()==10){
|
|
|
173 |
if(isInternetOn()) {
|
|
|
174 |
JSONObject props = new JSONObject();
|
|
|
175 |
try {
|
|
|
176 |
mixpanel.identify(userData.getString("id",null));
|
|
|
177 |
props.put("Screen", "Mobile Verification");
|
|
|
178 |
mixpanel.track("First Time Mobile Number Entered",props);
|
|
|
179 |
} catch (JSONException e) {
|
|
|
180 |
e.printStackTrace();
|
|
|
181 |
}
|
| 16278 |
manas |
182 |
if(!(userData.getString("id", "").isEmpty())) {
|
|
|
183 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
|
|
184 |
AnalyticsUtility.getAnalyticsRequest(MobileNumber.this, userData.getString("id", ""), "Clicks", "Mobile Number", "Mobile Number Entered"),
|
|
|
185 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
|
|
186 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MobileNumber.this);
|
|
|
187 |
}
|
| 14792 |
manas |
188 |
new pushVerification().execute();
|
|
|
189 |
}else{
|
|
|
190 |
Toast.makeText(getApplicationContext(), "No internet connection. Please try again.", Toast.LENGTH_SHORT).show();
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
}
|
|
|
194 |
else{
|
|
|
195 |
Toast.makeText(getApplicationContext(), "Mobile Number not valid.", Toast.LENGTH_SHORT).show();
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
}
|
|
|
199 |
});
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
@Override
|
|
|
206 |
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
207 |
getMenuInflater().inflate(R.menu.menu_mobile_number, menu);
|
|
|
208 |
return true;
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
@Override
|
|
|
212 |
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
213 |
|
|
|
214 |
int id = item.getItemId();
|
|
|
215 |
if (id == R.id.action_settings) {
|
|
|
216 |
return true;
|
|
|
217 |
}
|
|
|
218 |
return super.onOptionsItemSelected(item);
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
@Override
|
|
|
222 |
public void onConnected(Bundle bundle) {
|
|
|
223 |
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
@Override
|
|
|
227 |
public void onConnectionSuspended(int i) {
|
|
|
228 |
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
@Override
|
|
|
232 |
public void onConnectionFailed(ConnectionResult connectionResult) {
|
|
|
233 |
|
|
|
234 |
}
|
|
|
235 |
|
| 16278 |
manas |
236 |
ProgressDialog pMobile;
|
| 14792 |
manas |
237 |
class pushVerification extends AsyncTask<String, Integer, String> {
|
|
|
238 |
|
|
|
239 |
@Override
|
|
|
240 |
protected void onPreExecute() {
|
|
|
241 |
super.onPreExecute();
|
| 16278 |
manas |
242 |
pMobile= new ProgressDialog(MobileNumber.this);
|
|
|
243 |
pMobile.setMessage("Saving Data");
|
|
|
244 |
pMobile.setCancelable(false);
|
|
|
245 |
pMobile.show();
|
| 14792 |
manas |
246 |
}
|
|
|
247 |
|
|
|
248 |
@Override
|
|
|
249 |
protected String doInBackground(String... arg0) {
|
|
|
250 |
HttpClient httpclient = new DefaultHttpClient();
|
|
|
251 |
try {
|
|
|
252 |
|
|
|
253 |
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
|
|
254 |
SimpleDateFormat sdf = new SimpleDateFormat(ProfitTillConstants.SQL_DATE_FORMAT);
|
|
|
255 |
String dateUpdated = sdf.format(new Date());
|
|
|
256 |
nameValuePairs.add(new BasicNameValuePair("id",userData.getString("id","")));
|
|
|
257 |
nameValuePairs.add(new BasicNameValuePair("mobile_number",phoneNumberFirstTime.getText().toString()));
|
|
|
258 |
nameValuePairs.add(new BasicNameValuePair("mobile_number_last_updated",dateUpdated));
|
|
|
259 |
String updateURL = apiData.getString("useredit.url","");
|
|
|
260 |
String url = updateURL+userData.getString("id","");
|
|
|
261 |
HttpPost httppost = new HttpPost(url);
|
|
|
262 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
|
|
263 |
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
|
|
|
264 |
HttpResponse response = httpclient.execute(httppost);
|
|
|
265 |
HttpEntity entity = response.getEntity();
|
|
|
266 |
int status = response.getStatusLine().getStatusCode();
|
|
|
267 |
JSONObject jObjGmail = new JSONObject(EntityUtils.toString(entity));
|
| 16278 |
manas |
268 |
|
| 14792 |
manas |
269 |
String success = jObjGmail.getString("success");
|
|
|
270 |
|
|
|
271 |
if(status == 200){
|
|
|
272 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
|
|
273 |
GoogleAnalyticsTracker.TrackerName.APP_TRACKER);
|
|
|
274 |
t.send(new HitBuilders.EventBuilder()
|
|
|
275 |
.setCategory("First Time Mobile Entered ")
|
|
|
276 |
.setAction("Number entered")
|
|
|
277 |
.setLabel("First Time Mobile entered")
|
|
|
278 |
.build());
|
|
|
279 |
}
|
|
|
280 |
if(success.equalsIgnoreCase("true")){
|
|
|
281 |
userDataEditor.putString("message","false");;
|
|
|
282 |
userDataEditor.commit();
|
|
|
283 |
return "true";
|
|
|
284 |
}else{
|
|
|
285 |
userDataEditor.putString("message","true");;
|
|
|
286 |
userDataEditor.commit();
|
|
|
287 |
return "false";
|
|
|
288 |
}
|
|
|
289 |
} catch (ClientProtocolException e) {
|
|
|
290 |
return "false";
|
|
|
291 |
} catch (IOException e) {
|
|
|
292 |
return "false";
|
|
|
293 |
}catch (Exception e){
|
|
|
294 |
return "false";
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
@Override
|
|
|
299 |
protected void onPostExecute(String result) {
|
|
|
300 |
super.onPostExecute(result);
|
| 16278 |
manas |
301 |
if(pMobile!=null) {
|
|
|
302 |
pMobile.dismiss();
|
|
|
303 |
}
|
|
|
304 |
if(result.equalsIgnoreCase("true")) {
|
|
|
305 |
Intent i = new Intent(MobileNumber.this, MobileVerificationFirstTime.class);
|
|
|
306 |
i.putExtra("numberVerification", phoneNumberFirstTime.getText().toString());
|
|
|
307 |
startActivity(i);
|
|
|
308 |
}
|
| 14792 |
manas |
309 |
}
|
|
|
310 |
}
|
|
|
311 |
|
|
|
312 |
@Override
|
|
|
313 |
public void onBackPressed() {
|
|
|
314 |
new AlertDialog.Builder(this)
|
|
|
315 |
.setIcon(android.R.drawable.ic_dialog_alert)
|
|
|
316 |
.setTitle("Exit!")
|
|
|
317 |
.setMessage("Are you sure you want to sign out?")
|
| 16278 |
manas |
318 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener(){
|
| 14792 |
manas |
319 |
@Override
|
|
|
320 |
public void onClick(DialogInterface dialog, int which) {
|
|
|
321 |
if(type1.equalsIgnoreCase("facebook")) {
|
|
|
322 |
Log.d("fblogout","logout");
|
|
|
323 |
if (Session.getActiveSession() != null) {
|
|
|
324 |
Session.getActiveSession().closeAndClearTokenInformation();
|
|
|
325 |
}
|
|
|
326 |
Session.setActiveSession(null);
|
|
|
327 |
userDataEditor.clear().commit();
|
|
|
328 |
startActivity(new Intent(MobileNumber.this, LoginActivity.class));
|
|
|
329 |
}
|
|
|
330 |
else{
|
|
|
331 |
Log.d("gmailLogout","logout");
|
|
|
332 |
signOutFromGplus();
|
|
|
333 |
if(glogout==true){
|
|
|
334 |
startActivity(new Intent(MobileNumber.this, LoginActivity.class));
|
|
|
335 |
}
|
|
|
336 |
}
|
|
|
337 |
|
|
|
338 |
}
|
|
|
339 |
|
|
|
340 |
})
|
|
|
341 |
.setNegativeButton("No", null)
|
|
|
342 |
.show();
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
public void signOutFromGplus() {
|
|
|
346 |
if (mGoogleApiClient.isConnected()) {
|
|
|
347 |
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
|
|
|
348 |
mGoogleApiClient.disconnect();
|
|
|
349 |
mGoogleApiClient.connect();
|
|
|
350 |
glogout=true;
|
|
|
351 |
userDataEditor.clear();
|
|
|
352 |
userDataEditor.commit();
|
|
|
353 |
} else {
|
|
|
354 |
glogout=false;
|
|
|
355 |
}
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
public final boolean isInternetOn() {
|
|
|
359 |
|
|
|
360 |
ConnectivityManager connec =
|
|
|
361 |
(ConnectivityManager)this.getSystemService(getBaseContext().CONNECTIVITY_SERVICE);
|
|
|
362 |
|
|
|
363 |
if ( connec.getNetworkInfo(0).getState() == android.net.NetworkInfo.State.CONNECTED ||
|
|
|
364 |
connec.getNetworkInfo(0).getState() == android.net.NetworkInfo.State.CONNECTING ||
|
|
|
365 |
connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.CONNECTING ||
|
|
|
366 |
connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.CONNECTED ) {
|
|
|
367 |
return true;
|
|
|
368 |
|
|
|
369 |
} else if (
|
|
|
370 |
connec.getNetworkInfo(0).getState() == android.net.NetworkInfo.State.DISCONNECTED ||
|
|
|
371 |
connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.DISCONNECTED ) {
|
|
|
372 |
|
|
|
373 |
return false;
|
|
|
374 |
}
|
|
|
375 |
return false;
|
|
|
376 |
}
|
|
|
377 |
|
| 18082 |
manas |
378 |
class NotificationOpenedData extends AsyncTask<ArrayList<NameValuePair>, Integer, String> {
|
|
|
379 |
|
|
|
380 |
@Override
|
|
|
381 |
protected void onPreExecute() {
|
|
|
382 |
super.onPreExecute();
|
|
|
383 |
}
|
|
|
384 |
|
|
|
385 |
@Override
|
|
|
386 |
protected String doInBackground(ArrayList<NameValuePair>... arg0) {
|
|
|
387 |
|
|
|
388 |
try {
|
|
|
389 |
HttpClient httpclient = new DefaultHttpClient();
|
|
|
390 |
HttpPost httppost = new HttpPost(apiData.getString("notication.data.url","http://api.profittill.com/pushnotifications/add"));
|
|
|
391 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
|
|
392 |
httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
|
|
|
393 |
HttpResponse response = httpclient.execute(httppost);
|
|
|
394 |
HttpEntity entity = response.getEntity();
|
|
|
395 |
int status = response.getStatusLine().getStatusCode();
|
|
|
396 |
nameValuePairsGcm.clear();
|
|
|
397 |
} catch (Exception e) {
|
|
|
398 |
Log.e("Fail 1", e.toString());
|
|
|
399 |
|
|
|
400 |
}
|
|
|
401 |
return "success";
|
|
|
402 |
}
|
|
|
403 |
|
|
|
404 |
@Override
|
|
|
405 |
protected void onPostExecute(String result) {
|
|
|
406 |
super.onPostExecute(result);
|
|
|
407 |
}
|
|
|
408 |
}
|
|
|
409 |
|
| 14792 |
manas |
410 |
}
|