| Line 8... |
Line 8... |
| 8 |
import android.graphics.Bitmap;
|
8 |
import android.graphics.Bitmap;
|
| 9 |
import android.graphics.BitmapFactory;
|
9 |
import android.graphics.BitmapFactory;
|
| 10 |
import android.media.RingtoneManager;
|
10 |
import android.media.RingtoneManager;
|
| 11 |
import android.net.Uri;
|
11 |
import android.net.Uri;
|
| 12 |
import android.os.AsyncTask;
|
12 |
import android.os.AsyncTask;
|
| - |
|
13 |
import android.os.Build;
|
| 13 |
import android.os.Bundle;
|
14 |
import android.os.Bundle;
|
| 14 |
import android.support.v4.app.NotificationCompat;
|
15 |
import android.support.v4.app.NotificationCompat;
|
| 15 |
import android.util.Log;
|
16 |
import android.util.Log;
|
| 16 |
|
17 |
|
| 17 |
import com.google.android.gms.analytics.HitBuilders;
|
18 |
import com.google.android.gms.analytics.HitBuilders;
|
| Line 240... |
Line 241... |
| 240 |
}
|
241 |
}
|
| 241 |
PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, resultIntent, 0);
|
242 |
PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, resultIntent, 0);
|
| 242 |
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
243 |
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
| 243 |
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.pmlauncher);
|
244 |
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.pmlauncher);
|
| 244 |
if (image==null) {
|
245 |
if (image==null) {
|
| 245 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
246 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
|
| - |
|
247 |
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
| 246 |
this).setSmallIcon(R.drawable.navigation_bar)
|
248 |
mBuilder.setSmallIcon(R.drawable.navigation_bar);
|
| - |
|
249 |
} else{
|
| - |
|
250 |
mBuilder.setSmallIcon(R.drawable.pmnotification3);
|
| - |
|
251 |
}
|
| 247 |
.setContentTitle(title)
|
252 |
mBuilder.setContentTitle(title);
|
| 248 |
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
|
253 |
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(msg));
|
| 249 |
.setContentText(msg)
|
254 |
mBuilder.setContentText(msg);
|
| 250 |
.setLargeIcon(bm)
|
255 |
mBuilder.setLargeIcon(bm);
|
| 251 |
.setAutoCancel(true)
|
256 |
mBuilder.setAutoCancel(true);
|
| 252 |
.setSound(alarmSound);
|
257 |
mBuilder.setSound(alarmSound);
|
| 253 |
mBuilder.setContentIntent(contentIntent);
|
258 |
mBuilder.setContentIntent(contentIntent);
|
| 254 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
259 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
| 255 |
} else {
|
260 |
} else {
|
| 256 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
261 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
|
| - |
|
262 |
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
| - |
|
263 |
mBuilder.setSmallIcon(R.drawable.navigation_bar);
|
| 257 |
this).
|
264 |
} else{
|
| 258 |
setSmallIcon(R.drawable.pmnotification3)
|
265 |
mBuilder.setSmallIcon(R.drawable.pmnotification3);
|
| - |
|
266 |
}
|
| 259 |
.setContentTitle(title)
|
267 |
mBuilder.setContentTitle(title);
|
| 260 |
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
|
268 |
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(msg));
|
| 261 |
.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image))
|
269 |
mBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image));
|
| 262 |
.setContentText(msg)
|
270 |
mBuilder.setContentText(msg);
|
| 263 |
.setLargeIcon(bm)
|
271 |
mBuilder.setLargeIcon(bm);
|
| 264 |
.setAutoCancel(true)
|
272 |
mBuilder.setAutoCancel(true);
|
| 265 |
.setSound(alarmSound);
|
273 |
mBuilder.setSound(alarmSound);
|
| 266 |
mBuilder.setContentIntent(contentIntent);
|
274 |
mBuilder.setContentIntent(contentIntent);
|
| 267 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
275 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
| 268 |
}
|
276 |
}
|
| 269 |
|
277 |
|
| 270 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
278 |
Tracker t = ((GoogleAnalyticsTracker) getApplicationContext()).getTracker(
|
| Line 429... |
Line 437... |
| 429 |
}
|
437 |
}
|
| 430 |
PendingIntent contentIntent = PendingIntent.getActivity(GoogleAnalyticsTracker.getAppContext(), NOTIFICATION_ID, resultIntent, 0);
|
438 |
PendingIntent contentIntent = PendingIntent.getActivity(GoogleAnalyticsTracker.getAppContext(), NOTIFICATION_ID, resultIntent, 0);
|
| 431 |
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
439 |
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
| 432 |
Bitmap bm = BitmapFactory.decodeResource(GoogleAnalyticsTracker.getAppContext().getResources(), R.drawable.pmlauncher);
|
440 |
Bitmap bm = BitmapFactory.decodeResource(GoogleAnalyticsTracker.getAppContext().getResources(), R.drawable.pmlauncher);
|
| 433 |
if (bitmap==null) {
|
441 |
if (bitmap==null) {
|
| 434 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
442 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(c);
|
| - |
|
443 |
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
| - |
|
444 |
mBuilder.setSmallIcon(R.drawable.navigation_bar);
|
| 435 |
c )
|
445 |
} else{
|
| 436 |
.setSmallIcon(R.drawable.navigation_bar)
|
446 |
mBuilder.setSmallIcon(R.drawable.pmnotification3);
|
| - |
|
447 |
}
|
| 437 |
.setContentTitle(title)
|
448 |
mBuilder.setContentTitle(title);
|
| 438 |
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
|
449 |
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(msg));
|
| 439 |
.setContentText(msg)
|
450 |
mBuilder.setContentText(msg);
|
| 440 |
.setLargeIcon(bm)
|
451 |
mBuilder.setLargeIcon(bm);
|
| 441 |
.setAutoCancel(true)
|
452 |
mBuilder.setAutoCancel(true);
|
| 442 |
.setSound(alarmSound);
|
453 |
mBuilder.setSound(alarmSound);
|
| - |
|
454 |
|
| 443 |
mBuilder.setContentIntent(contentIntent);
|
455 |
mBuilder.setContentIntent(contentIntent);
|
| 444 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
456 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
| 445 |
}
|
457 |
}
|
| 446 |
|
458 |
|
| 447 |
else {
|
459 |
else {
|
| 448 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
460 |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
|
| 449 |
GoogleAnalyticsTracker.getAppContext())
|
461 |
GoogleAnalyticsTracker.getAppContext());
|
| - |
|
462 |
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
| - |
|
463 |
mBuilder.setSmallIcon(R.drawable.navigation_bar);
|
| - |
|
464 |
} else{
|
| 450 |
.setSmallIcon(R.drawable.pmnotification3)
|
465 |
mBuilder.setSmallIcon(R.drawable.pmnotification3);
|
| - |
|
466 |
}
|
| 451 |
.setContentTitle(title)
|
467 |
mBuilder.setContentTitle(title);
|
| 452 |
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
|
468 |
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(msg));
|
| 453 |
.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(bitmap))
|
469 |
mBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(bitmap));
|
| 454 |
.setContentText(msg)
|
470 |
mBuilder.setContentText(msg);
|
| 455 |
.setLargeIcon(bm)
|
471 |
mBuilder.setLargeIcon(bm);
|
| 456 |
.setAutoCancel(true)
|
472 |
mBuilder.setAutoCancel(true);
|
| 457 |
.setSound(alarmSound);
|
473 |
mBuilder.setSound(alarmSound);
|
| 458 |
mBuilder.setContentIntent(contentIntent);
|
474 |
mBuilder.setContentIntent(contentIntent);
|
| 459 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
475 |
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
|
| 460 |
}
|
476 |
}
|
| 461 |
++NOTIFICATION_ID;
|
477 |
++NOTIFICATION_ID;
|
| 462 |
JSONObject data = new JSONObject();
|
478 |
JSONObject data = new JSONObject();
|