| Line 133... |
Line 133... |
| 133 |
return "true";
|
133 |
return "true";
|
| 134 |
}
|
134 |
}
|
| 135 |
|
135 |
|
| 136 |
}
|
136 |
}
|
| 137 |
|
137 |
|
| 138 |
@Override
|
138 |
@Override
|
| 139 |
protected void onPostExecute(String result) {
|
139 |
public String toString() {
|
| 140 |
super.onPostExecute(result);
|
140 |
return super.toString();
|
| 141 |
if (result.isEmpty() || result.equals(null) || result.equalsIgnoreCase("true")) {
|
- |
|
| 142 |
if (notificationData.getString("cid", "").equalsIgnoreCase(extras.get("cid").toString().split("_")[0])) {
|
- |
|
| 143 |
Log.d("Campaign Id is same " + notificationData.getString("cid", ""), "Campaign Id is same " + extras.get("cid").toString().split("_")[0]);
|
- |
|
| 144 |
}
|
141 |
}
|
| - |
|
142 |
|
| 145 |
else {
|
143 |
@Override
|
| 146 |
notificationDataEditor.putString("cid", extras.get("cid").toString().split("_")[0]);
|
- |
|
| 147 |
notificationDataEditor.commit();
|
144 |
protected void onPostExecute(String result) {
|
| 148 |
sendNotification(extras.get("message") + "", extras.get("type") + "", extras.get("title") + "", extras.get("url") + "", extras.get("cid") + "", bitmap);
|
- |
|
| 149 |
}
|
- |
|
| 150 |
} else {
|
- |
|
| 151 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
- |
|
| 152 |
AnalyticsUtility.getAnalyticsRequest(getApplicationContext(), userData.getString("id", ""), "Notification", "Notification Expired", extras.get("cid") + ""),
|
- |
|
| 153 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
- |
|
| 154 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(getApplicationContext());
|
- |
|
| 155 |
nameValuePairsGcm = new ArrayList<>();
|
145 |
super.onPostExecute(result);
|
| 156 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", userData.getString("id", "")));
|
146 |
if (result.isEmpty() || result.equals(null) || result.equalsIgnoreCase("true")) {
|
| 157 |
nameValuePairsGcm.add(new BasicNameValuePair("cid", extras.get("cid") + ""));
|
147 |
if (notificationData.getString("cid", "").equalsIgnoreCase(extras.get("cid").toString().split("_")[0])) {
|
| 158 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
148 |
Log.d("Campaign Id is same " + notificationData.getString("cid", ""), "Campaign Id is same " + extras.get("cid").toString().split("_")[0]);
|
| 159 |
nameValuePairsGcm.add(new BasicNameValuePair("result", "expired"));
|
- |
|
| 160 |
new NotificationRecievedData().execute(nameValuePairsGcm);
|
- |
|
| 161 |
}
|
149 |
}
|
| - |
|
150 |
else {
|
| - |
|
151 |
notificationDataEditor.putString("cid", extras.get("cid").toString().split("_")[0]);
|
| - |
|
152 |
notificationDataEditor.commit();
|
| - |
|
153 |
sendNotification(extras.get("message") + "", extras.get("type") + "", extras.get("title") + "", extras.get("url") + "", extras.get("cid") + "", bitmap);
|
| - |
|
154 |
}
|
| - |
|
155 |
} else {
|
| - |
|
156 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
157 |
AnalyticsUtility.getAnalyticsRequest(getApplicationContext(), userData.getString("id", ""), "Notification", "Notification Expired", extras.get("cid") + ""),
|
| - |
|
158 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
159 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(getApplicationContext());
|
| - |
|
160 |
nameValuePairsGcm = new ArrayList<>();
|
| - |
|
161 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", userData.getString("id", "")));
|
| - |
|
162 |
nameValuePairsGcm.add(new BasicNameValuePair("cid", extras.get("cid") + ""));
|
| - |
|
163 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
| - |
|
164 |
nameValuePairsGcm.add(new BasicNameValuePair("result", "expired"));
|
| - |
|
165 |
new NotificationRecievedData().execute(nameValuePairsGcm);
|
| 162 |
}
|
166 |
}
|
| 163 |
}
|
167 |
}
|
| - |
|
168 |
}
|
| 164 |
|
169 |
|
| 165 |
private void sendNotification(String msg, String type, String title, String url, String cid, Bitmap image) {
|
170 |
private void sendNotification(String msg, String type, String title, String url, String cid, Bitmap image) {
|
| 166 |
JSONObject propsNotificationRecieved = new JSONObject();
|
171 |
JSONObject propsNotificationRecieved = new JSONObject();
|
| 167 |
Bundle bundle;
|
172 |
Bundle bundle;
|
| 168 |
try {
|
173 |
try {
|
| Line 188... |
Line 193... |
| 188 |
//resultIntent = new Intent(this, ReferrerActivity.class);
|
193 |
//resultIntent = new Intent(this, ReferrerActivity.class);
|
| 189 |
//resultIntent.setAction("Login");
|
194 |
//resultIntent.setAction("Login");
|
| 190 |
//bundle = new Bundle();
|
195 |
//bundle = new Bundle();
|
| 191 |
// bundle.putString("cid", cid);
|
196 |
// bundle.putString("cid", cid);
|
| 192 |
//resultIntent.putExtras(bundle);} */
|
197 |
//resultIntent.putExtras(bundle);} */
|
| 193 |
else {
|
198 |
else {
|
| 194 |
if (type.equalsIgnoreCase("Url")) {
|
199 |
if (type.equalsIgnoreCase("Url")) {
|
| 195 |
resultIntent = new Intent(this, MainActivity.class);
|
200 |
resultIntent = new Intent(this, MainActivity.class);
|
| 196 |
bundle = new Bundle();
|
201 |
bundle = new Bundle();
|
| 197 |
bundle.putString("cid", cid);
|
202 |
bundle.putString("cid", cid);
|
| 198 |
resultIntent.putExtras(bundle);
|
203 |
resultIntent.putExtras(bundle);
|
| Line 438... |
Line 443... |
| 438 |
PendingIntent contentIntent = PendingIntent.getActivity(GoogleAnalyticsTracker.getAppContext(), NOTIFICATION_ID, resultIntent, 0);
|
443 |
PendingIntent contentIntent = PendingIntent.getActivity(GoogleAnalyticsTracker.getAppContext(), NOTIFICATION_ID, resultIntent, 0);
|
| 439 |
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
444 |
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
| 440 |
Bitmap bm = BitmapFactory.decodeResource(GoogleAnalyticsTracker.getAppContext().getResources(), R.drawable.pmlauncher);
|
445 |
Bitmap bm = BitmapFactory.decodeResource(GoogleAnalyticsTracker.getAppContext().getResources(), R.drawable.pmlauncher);
|
| 441 |
if (bitmap==null) {
|
446 |
if (bitmap==null) {
|
| 442 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
447 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
| 443 |
c )
|
448 |
c )
|
| 444 |
.setSmallIcon(R.drawable.navigation_bar)
|
449 |
.setSmallIcon(R.drawable.navigation_bar)
|
| 445 |
.setContentTitle(title)
|
450 |
.setContentTitle(title)
|
| 446 |
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
|
451 |
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
|
| 447 |
.setContentText(msg)
|
452 |
.setContentText(msg)
|
| 448 |
.setLargeIcon(bm)
|
453 |
.setLargeIcon(bm)
|