Example usage for android.app Notification DEFAULT_ALL

List of usage examples for android.app Notification DEFAULT_ALL

Introduction

In this page you can find the example usage for android.app Notification DEFAULT_ALL.

Prototype

int DEFAULT_ALL

To view the source code for android.app Notification DEFAULT_ALL.

Click Source Link

Document

Use all default values (where applicable).

Usage

From source file:org.ohmage.sync.OhmageSyncAdapter.java

private void showInstallApkNotification(int id, Builder builder, Intent intent) {
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent resultPendingIntent = PendingIntent.getActivity(getContext(), 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(resultPendingIntent).setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL);

    NotificationManager mNotificationManager = (NotificationManager) getContext()
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(id, builder.build());
}

From source file:com.newcell.calltext.service.SipNotifications.java

public void showNotificationForMessage(SipMessage msg) {
    if (!CustomDistribution.supportMessaging()) {
        return;/*from   ww w . j ava2 s  .  co  m*/
    }

    if (!msg.getFrom().equalsIgnoreCase(viewingRemoteFrom)) {
        CallerInfo callerInfo = CallerInfo.getCallerInfoFromSipUri(context, msg.getFullFrom());
        String from;
        if (callerInfo != null && callerInfo.contactExists) {
            from = callerInfo.name;
        } else {
            from = callerInfo.phoneNumber;
        }
        //         String from = SipUri.getDisplayedSimpleContact(msg.getFullFrom()); // Old version
        //         if(from.equalsIgnoreCase(msg.getFullFrom()) && !from.equals(msg.getDisplayName())) {
        //             from = msg.getDisplayName() + " " + from;
        //         }
        CharSequence tickerText = buildTickerMessage(context, from, msg.getBody());

        if (messageNotification == null) {
            messageNotification = new NotificationCompat.Builder(context);
            messageNotification.setSmallIcon(SipUri.isPhoneNumber(from) ? R.drawable.stat_notify_sms
                    : android.R.drawable.stat_notify_chat);
            messageNotification.setTicker(tickerText);
            messageNotification.setWhen(System.currentTimeMillis());
            messageNotification.setDefaults(Notification.DEFAULT_ALL);
            messageNotification.setAutoCancel(true);
            messageNotification.setOnlyAlertOnce(true);
        }

        Intent notificationIntent = new Intent(SipManager.ACTION_SIP_MESSAGES);
        notificationIntent.putExtra(SipMessage.FIELD_FROM, msg.getFrom());
        notificationIntent.putExtra(SipMessage.FIELD_BODY, msg.getBody());
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
                PendingIntent.FLAG_CANCEL_CURRENT);

        messageNotification.setContentTitle(from);
        messageNotification.setContentText(msg.getBody());
        messageNotification.setContentIntent(contentIntent);

        notificationManager.notify(MESSAGE_NOTIF_ID, messageNotification.build());
    }
}

From source file:com.sonetel.service.SipNotifications.java

public void showNotificationForMissedCall(ContentValues callLog) {
    int icon = android.R.drawable.stat_notify_missed_call;
    CharSequence tickerText = context.getText(R.string.missed_call);
    long when = System.currentTimeMillis();

    if (missedCallNotification == null) {
        missedCallNotification = new NotificationCompat.Builder(context);
        missedCallNotification.setSmallIcon(icon);
        missedCallNotification.setTicker(tickerText);
        missedCallNotification.setWhen(when);
        missedCallNotification.setOnlyAlertOnce(true);
        missedCallNotification.setAutoCancel(true);
        missedCallNotification.setDefaults(Notification.DEFAULT_ALL);
    }//from  w  ww.j a va  2s  .  c om

    Intent notificationIntent = new Intent(SipManager.ACTION_SIP_CALLLOG);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    String remoteContact = callLog.getAsString(CallLog.Calls.NUMBER);
    long accId = callLog.getAsLong(SipManager.CALLLOG_PROFILE_ID_FIELD);
    missedCallNotification.setContentTitle(formatNotificationTitle(R.string.missed_call, accId));
    missedCallNotification.setContentText(formatRemoteContactString(remoteContact));
    missedCallNotification.setContentIntent(contentIntent);

    notificationManager.notify(CALLLOG_NOTIF_ID, missedCallNotification.getNotification());
}

From source file:cn.devit.app.ip_messenger.MainActivity.java

void setupListener() {
    handler = new Handler() {
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case ADD_USER:
                userList.add((UserData) msg.obj);
                // view?
                if (sendView != null && sendView.userList != null) {
                    sendView.userList.setUserList(userList);
                } else {
                    // TODO a deferred event must notice.
                }//from  w w  w  . j a  va2s .com

                break;
            case RECEIVE_MSG:
                final PigeonMessage m = (PigeonMessage) msg.obj;

                String tip = m.getContent();
                if (m.hasAttachements()) {
                    String attachementsDesc = "";
                    for (AttachementLink item : m.getAttachements()) {
                        attachementsDesc += item.getFilename();
                    }
                    tip += "" + attachementsDesc;

                    final NotificationManager notificationManager = (NotificationManager) getSystemService(
                            Context.NOTIFICATION_SERVICE);
                    new AlertDialog.Builder(MainActivity.this).setIcon(android.R.drawable.ic_dialog_info)
                            .setTitle("").setMessage(attachementsDesc)
                            .setPositiveButton("", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    // TODO reject file
                                    notificationManager.cancel(m.hashCode());
                                    startDownloadAttachment(m);
                                }
                            }).setNegativeButton("?", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    Log.d("main", "cancel notify NO.=" + m.hashCode());
                                    notificationManager.cancel(m.hashCode());
                                    // notificationManager.cancelAll();

                                    new Thread(new Runnable() {

                                        @Override
                                        public void run() {
                                            network.rejectAttachement(m);

                                        }
                                    }).start();

                                }
                            }).show();

                    Intent notificationIntent = new Intent(MainActivity.this, MainActivity.class); // ??Activity
                    PendingIntent contentItent = PendingIntent.getActivity(MainActivity.this, 0,
                            notificationIntent, 0);
                    // TODO move to method.
                    Notification notification = new NotificationCompat.Builder(getApplicationContext())
                            .setSmallIcon(R.drawable.ic_launcher).setContentTitle("?")
                            .setContentText(attachementsDesc).setStyle(new NotificationCompat.InboxStyle())
                            .setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL)
                            .addAction(0, "agree", contentItent).addAction(0, "dismiss", contentItent).build();

                    // new Notification.Builder(
                    // getApplicationContext()).setTicker("?")
                    // // .setLargeIcon(R.drawable.ic_launcher)
                    // .setSmallIcon(R.drawable.ic_launcher).build();
                    // notification.flags |=
                    // (Notification.FLAG_AUTO_CANCEL);
                    // notification.defaults = Notification.DEFAULT_ALL;
                    // String title = "?";

                    // NotificationNotificationManager
                    Log.d("main", "show notify NO.=" + m.hashCode());
                    notificationManager.notify(m.hashCode(), notification);

                }
                Toast.makeText(getApplication(), tip, Toast.LENGTH_SHORT).show();

                DummyContent1.addItem(String.valueOf(i++), m.getSender().getUsername(), tip);
                break;
            default:
                Toast.makeText(getApplication(), String.valueOf(msg.obj), Toast.LENGTH_SHORT).show();
            }
            ;
        }
    };
    listener.handler = handler;
}

From source file:com.newcell.calltext.service.SipNotifications.java

public void showNotificationForVoiceMail(SipProfile acc, int numberOfMessages) {
    if (messageVoicemail == null) {

        messageVoicemail = new NotificationCompat.Builder(context);
        messageVoicemail.setSmallIcon(android.R.drawable.stat_notify_voicemail);
        messageVoicemail.setTicker(context.getString(R.string.voice_mail));
        messageVoicemail.setWhen(System.currentTimeMillis());
        messageVoicemail.setDefaults(Notification.DEFAULT_ALL);
        messageVoicemail.setAutoCancel(true);
        messageVoicemail.setOnlyAlertOnce(true);
    }/*  w  w  w.  j  a  v  a  2s  .  c  o m*/

    PendingIntent contentIntent = null;
    Intent notificationIntent;
    /*
     * 8/06/2014 Removed check for voicemail number. Changed it to call *86
             
    if (acc != null && !TextUtils.isEmpty(acc.vm_nbr) && acc.vm_nbr != "null") {
    notificationIntent = new Intent(Intent.ACTION_CALL);
    notificationIntent.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, acc.vm_nbr
            + "@" + acc.getDefaultDomain()));
    notificationIntent.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
    }
            
     * 
     */
    if (acc != null) {
        notificationIntent = new Intent(Intent.ACTION_CALL);
        notificationIntent.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, "*86"));
        notificationIntent.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
    } else {
        notificationIntent = new Intent(SipManager.ACTION_SIP_DIALER);
    }
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    String messageText = "";
    /*
     * 6/11/2014 Removed account name from voicemail notification
             
    if (acc != null) {
    messageText += acc.getProfileName() + " : ";
    }
            
     * 6/11/2014 Removed account name from voicemail notification
     */
    messageText = Integer.toString(numberOfMessages);
    messageText += " new " + context.getString(R.string.voice_mail);
    if (numberOfMessages > 1)
        messageText += "s";

    messageVoicemail.setContentTitle(context.getString(R.string.voice_mail));
    messageVoicemail.setContentText(messageText);
    if (contentIntent != null) {
        messageVoicemail.setContentIntent(contentIntent);
        notificationManager.notify(VOICEMAIL_NOTIF_ID, messageVoicemail.build());
    }
}

From source file:com.roamprocess1.roaming4world.service.SipNotifications.java

public void showNotificationForMessage(SipMessage msg) {
    if (!CustomDistribution.supportMessaging()) {
        return;/*from   ww w . j a v a2s. com*/
    }
    //CharSequence tickerText = context.getText(R.string.instance_message);

    if (!msg.getFrom().equalsIgnoreCase(viewingRemoteFrom)) {
        String from = formatRemoteContactString(msg.getFullFrom());

        if (from.equalsIgnoreCase(msg.getFullFrom())) {
            from = msg.getDisplayName() + " " + from;
        }

        String[] msgNumber = from.split("<");
        String msNumber = msgNumber[0];

        CharSequence tickerText = buildTickerMessage(context, msNumber, msg.getBody());

        if (messageNotification == null) {
            messageNotification = new NotificationCompat.Builder(context);
            messageNotification.setSmallIcon(
                    SipUri.isPhoneNumber(msNumber) ? R.drawable.r4wlogowhitefill : R.drawable.r4wlogowhitefill);

            String tick = tickerText.toString();

            if (tick.contains("\n")) {
                String[] arr = tick.split("\n");
                tick = arr[arr.length - 1];
            }

            if (tick.contains(imagefile)) {
                String[] arr = tick.trim().split("@@");
                arr = arr[1].split("-");
                if (arr[0].equals("VID")) {
                    messageNotification.setTicker("Sent a video");
                } else if (arr[0].equals("AUD")) {
                    messageNotification.setTicker("Sent an audio");
                } else if (arr[0].equals("IMG")) {
                    messageNotification.setTicker("Sent an image");
                } else if (arr[0].equals("CON")) {
                    messageNotification.setTicker("Sent a contact");
                } else if (arr[0].equals("LOC")) {
                    messageNotification.setTicker("Sent a location");
                }
            } else {
                messageNotification.setTicker("Sent a message");
            }

            System.out.println("Tick==" + tick);

            messageNotification.setWhen(System.currentTimeMillis());
            messageNotification.setDefaults(Notification.DEFAULT_ALL);
            messageNotification.setAutoCancel(true);
            messageNotification.setOnlyAlertOnce(true);
        }

        Intent notificationIntent = new Intent(context, MessageActivity.class);
        System.out.println("msg.getFrom()   ==" + msg.getFrom() + " " + msg.getBody());

        notificationIntent.putExtra(SipMessage.FIELD_FROM, msg.getFrom());
        notificationIntent.putExtra(SipMessage.FIELD_BODY, msg.getBody());
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
                PendingIntent.FLAG_CANCEL_CURRENT);
        String n = from;

        if (n.contains(" ")) {
            String[] nn = n.split(" ");
            n = nn[0];
        }

        messageNotification.setContentTitle(n);
        if (msg.getBody().toString().contains(imagefile)) {
            String[] arr = msg.getBody().toString().trim().split("@@");
            arr = arr[1].split("-");
            if (arr[0].equals("VID")) {
                messageNotification.setTicker("Sent a video");
            } else if (arr[0].equals("AUD")) {
                messageNotification.setTicker("Sent an audio");
            } else if (arr[0].equals("IMG")) {
                messageNotification.setTicker("Sent an image");
            } else if (arr[0].equals("CON")) {
                messageNotification.setTicker("Sent a contact");
            } else if (arr[0].equals("LOC")) {
                messageNotification.setTicker("Sent a location");
            }
        } else {
            messageNotification.setContentText(msg.getBody());
        }
        messageNotification.setContentIntent(contentIntent);

        System.out.println("messageNotification.build() ==" + messageNotification.build() + "");

        if (!msg.getFrom().equals("sip:registrar@kamailio.org")
                && !msg.getBody().contains("[Offline message -")) {
            notificationManager.notify(MESSAGE_NOTIF_ID, messageNotification.build());
        }
    }
}

From source file:com.polkapolka.bluetooth.le.DeviceControlActivity.java

public void showNotification(View view) {
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setContentTitle(getString(R.string.NotifationTitle))
            .setContentText(getString(R.string.NotificationSubtitle))
            .setTicker(getString(R.string.NotificationTicker)).setSmallIcon(R.drawable.icon);
    // Define that we have the intention of opening MoreInfoNotification
    Intent moreInfoIntent = new Intent(this, userActivity.class);

    // Used to stack tasks across activites so we go to the proper place when back is clicked
    TaskStackBuilder tStackBuilder = TaskStackBuilder.create(this);

    // Add all parents of this activity to the stack
    tStackBuilder.addParentStack(DeviceControlActivity.class);

    // Add our new Intent to the stack
    tStackBuilder.addNextIntent(moreInfoIntent);
    notificationBuilder.setDefaults(Notification.DEFAULT_ALL);
    notificationBuilder.setAutoCancel(true);

    // Define an Intent and an action to perform with it by another application
    // FLAG_UPDATE_CURRENT : If the intent exists keep it but update it if needed
    PendingIntent pendingIntent = tStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    // Defines the Intent to fire when the notification is clicked

    notificationBuilder.setContentIntent(pendingIntent);

    // Gets a NotificationManager which is used to notify the user of the background event
    notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    // Post the notification
    notificationManager.notify(notifID, notificationBuilder.build());

}

From source file:com.sonetel.service.SipNotifications.java

public void showNotificationForMessage(SipMessage msg) {
    if (!CustomDistribution.supportMessaging()) {
        return;/*ww  w . j  av  a  2s  .  c om*/
    }
    // CharSequence tickerText = context.getText(R.string.instance_message);
    if (!msg.getFrom().equalsIgnoreCase(viewingRemoteFrom)) {
        String from = formatRemoteContactString(msg.getFullFrom());
        if (from.equalsIgnoreCase(msg.getFullFrom())) {
            from = msg.getDisplayName() + " " + from;
        }
        CharSequence tickerText = buildTickerMessage(context, from, msg.getBody());

        if (messageNotification == null) {
            messageNotification = new NotificationCompat.Builder(context);
            messageNotification.setSmallIcon(SipUri.isPhoneNumber(from) ? R.drawable.stat_notify_sms
                    : android.R.drawable.stat_notify_chat);
            messageNotification.setTicker(tickerText);
            messageNotification.setWhen(System.currentTimeMillis());
            messageNotification.setDefaults(Notification.DEFAULT_ALL);
            messageNotification.setAutoCancel(true);
            messageNotification.setOnlyAlertOnce(true);
        }

        Intent notificationIntent = new Intent(SipManager.ACTION_SIP_MESSAGES);
        notificationIntent.putExtra(SipMessage.FIELD_FROM, msg.getFrom());
        notificationIntent.putExtra(SipMessage.FIELD_BODY, msg.getBody());
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
                PendingIntent.FLAG_CANCEL_CURRENT);

        messageNotification.setContentTitle(from);
        messageNotification.setContentText(msg.getBody());
        messageNotification.setContentIntent(contentIntent);

        notificationManager.notify(MESSAGE_NOTIF_ID, messageNotification.getNotification());
    }
}

From source file:com.z3r0byte.magistify.Services.OldBackgroundService.java

private void gradeTimer() {
    Log.d(TAG, "gradeTimer: Starting grade timer");
    TimerTask gradeStack = new TimerTask() {
        @Override//w w w.  j a va2s.c o m
        public void run() {
            if (!allowDataTransfer()) {
                return;
            }
            Magister magister = GlobalAccount.MAGISTER;
            if (magister == null || magister.isExpired()) {
                Log.e(TAG, "New Grade Notification: Invalid magister");
                return;
            } else {
                NewGradesDB gradesdb = new NewGradesDB(getApplicationContext());

                GradeHandler gradeHandler = new GradeHandler(magister);
                Grade[] gradeArray;
                List<Grade> gradeList = new ArrayList<Grade>();
                try {
                    gradeArray = gradeHandler.getRecentGrades();
                    gradesdb.addGrades(gradeArray);
                    Collections.reverse(Arrays.asList(gradeArray));

                    //For testing purposes:
                    /*Grade sampleGrade = new Grade();
                    sampleGrade.isSufficient = false;
                    sampleGrade.grade = "2.3";
                    sampleGrade.subject = new SubSubject();
                    sampleGrade.subject.name = "Latijn";
                            
                    Grade sampleGrade2 = new Grade();
                    sampleGrade2.isSufficient = true;
                    sampleGrade2.grade = "6.5";
                    sampleGrade2.subject = new SubSubject();
                    sampleGrade2.subject.name = "Nederlands";
                            
                    gradeArray = new Grade[2];
                    gradeArray[0] = sampleGrade;
                    gradeArray[1] = sampleGrade2;*/

                    for (Grade grade : gradeArray) {
                        if (!gradesdb.hasBeenSeen(grade, false)
                                && (grade.isSufficient || !configUtil.getBoolean("pass_grades_only"))) {
                            gradeList.add(grade);
                        }
                    }

                } catch (IOException | AssertionError | NullPointerException e) {
                    e.printStackTrace();
                    return;
                }
                String GradesNotification = new Gson().toJson(gradeList);
                if (gradeList != null && gradeList.size() > 0
                        && !configUtil.getString("lastGradesNotification").equals(GradesNotification)) {

                    Log.d(TAG, "New Grade Notification: Some grades to show: " + gradeList.size());

                    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
                            getApplicationContext());
                    mBuilder.setSmallIcon(R.drawable.ic_grade_notification);

                    if (gradeList.size() == 1) {
                        Grade grade = gradeList.get(0);
                        mBuilder.setContentTitle("Nieuw cijfer voor " + grade.subject.name);
                        //mBuilder.setStyle(new NotificationCompat.BigTextStyle(mBuilder).bigText())
                        mBuilder.setContentText("Een " + grade.grade);
                    } else {
                        String content = "";
                        for (Grade grade : gradeList) {
                            String string = grade.subject.name + ", een " + grade.grade;
                            if (content.length() > 1) {
                                content = content + "\n" + string;
                            } else {
                                content = string;
                            }
                        }
                        mBuilder.setContentTitle("Nieuwe cijfers voor:");
                        mBuilder.setStyle(new NotificationCompat.BigTextStyle(mBuilder).bigText(content));
                        mBuilder.setContentText(content);
                    }
                    mBuilder.setAutoCancel(true);
                    mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
                    mBuilder.setDefaults(Notification.DEFAULT_ALL);
                    mBuilder.setLights(Color.LTGRAY, 300, 200);

                    Intent resultIntent = new Intent(getApplicationContext(), NewGradeActivity.class);
                    TaskStackBuilder stackBuilder = TaskStackBuilder.create(getApplicationContext());
                    stackBuilder.addParentStack(NewGradeActivity.class);
                    stackBuilder.addNextIntent(resultIntent);
                    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
                            PendingIntent.FLAG_UPDATE_CURRENT);
                    mBuilder.setContentIntent(resultPendingIntent);

                    NotificationManager mNotificationManager = (NotificationManager) getSystemService(
                            Context.NOTIFICATION_SERVICE);
                    mNotificationManager.notify(9992, mBuilder.build());

                    configUtil.setString("lastGradesNotification", GradesNotification);
                } else {
                    Log.w(TAG, "New Grade Notification: No grades!");
                }
            }
        }
    };
    timer.schedule(gradeStack, 6000, 120 * 1000);
}

From source file:com.adkdevelopment.earthquakesurvival.data.syncadapter.SyncAdapter.java

/**
 * Raises a notification with a biggest earthquake with each sync
 *
 * @param notifyValues data with the biggest recent earthquake
 *//*from ww w.ja  va2 s.c o m*/
private void sendNotification(ContentValues notifyValues) {

    Context context = getContext();

    if (Utilities.getNotificationsPrefs(context) && !Utilities.checkForeground(context)) {

        //checking the last update and notify if it' the first of the day
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        String lastNotificationKey = context.getString(R.string.sharedprefs_key_lastnotification);
        long lastSync = prefs.getLong(lastNotificationKey, 0);

        if (System.currentTimeMillis() - lastSync >= DateUtils.DAY_IN_MILLIS) {
            Intent intent = new Intent(context, DetailActivity.class);

            double latitude = notifyValues.getAsDouble(EarthquakeColumns.LATITUDE);
            double longitude = notifyValues.getAsDouble(EarthquakeColumns.LONGITUDE);
            LatLng latLng = new LatLng(latitude, longitude);

            String distance = context.getString(R.string.earthquake_distance,
                    LocationUtils.getDistance(latLng, LocationUtils.getLocation(context)));

            String magnitude = context.getString(R.string.earthquake_magnitude,
                    notifyValues.getAsDouble(EarthquakeColumns.MAG));
            String date = Utilities.getRelativeDate(notifyValues.getAsLong(EarthquakeColumns.TIME));

            double depth = notifyValues.getAsDouble(EarthquakeColumns.DEPTH);

            intent.putExtra(Feature.MAGNITUDE, notifyValues.getAsDouble(EarthquakeColumns.MAG));
            intent.putExtra(Feature.PLACE, notifyValues.getAsString(EarthquakeColumns.PLACE));
            intent.putExtra(Feature.DATE, date);
            intent.putExtra(Feature.LINK, notifyValues.getAsString(EarthquakeColumns.URL));
            intent.putExtra(Feature.LATLNG, latLng);
            intent.putExtra(Feature.DISTANCE, distance);
            intent.putExtra(Feature.DEPTH, depth);
            intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

            PendingIntent pendingIntent = PendingIntent.getActivity(context, EarthquakeObject.NOTIFICATION_ID_1,
                    intent, PendingIntent.FLAG_UPDATE_CURRENT);

            NotificationCompat.Builder builder = new NotificationCompat.Builder(context);

            Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher);

            builder.setDefaults(Notification.DEFAULT_ALL).setAutoCancel(true)
                    .setContentTitle(context.getString(R.string.earthquake_statistics_largest))
                    .setContentText(context.getString(R.string.earthquake_magnitude,
                            notifyValues.get(EarthquakeColumns.MAG)))
                    .setContentIntent(pendingIntent).setSmallIcon(R.drawable.ic_info_black_24dp)
                    .setLargeIcon(largeIcon).setTicker(context.getString(R.string.app_name))
                    .setStyle(new NotificationCompat.BigTextStyle()
                            .bigText(notifyValues.get(EarthquakeColumns.PLACE).toString() + "\n" + magnitude
                                    + "\n" + context.getString(R.string.earthquake_depth, depth) + "\n"
                                    + distance + "\n" + date))
                    .setGroup(EarthquakeObject.NOTIFICATION_GROUP).setGroupSummary(true);

            NotificationManagerCompat managerCompat = NotificationManagerCompat.from(context);
            managerCompat.notify(EarthquakeObject.NOTIFICATION_ID_1, builder.build());

            //refreshing last sync
            boolean success = prefs.edit().putLong(lastNotificationKey, System.currentTimeMillis()).commit();
        }
    }
}