summaryrefslogtreecommitdiffstats
path: root/samples/Alarm/src/com
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2015-06-11 10:56:59 -0400
committerChris Wren <cwren@android.com>2015-06-11 16:51:44 -0400
commitb6ba3c5f648b17452e488ffced9cea2a39c7aecf (patch)
tree443c619df78491e7404978e98109d233a9007512 /samples/Alarm/src/com
parent28701d108d839ee157c0cae85bb8f3148d4ff3dc (diff)
downloadandroid_development-b6ba3c5f648b17452e488ffced9cea2a39c7aecf.tar.gz
android_development-b6ba3c5f648b17452e488ffced9cea2a39c7aecf.tar.bz2
android_development-b6ba3c5f648b17452e488ffced9cea2a39c7aecf.zip
remove setLatestEventInfo from API samples
Bug: 18510449 Change-Id: I26a9dbc6c92b226e28798e5a348c9357c85405ab
Diffstat (limited to 'samples/Alarm/src/com')
-rw-r--r--samples/Alarm/src/com/example/android/newalarm/AlarmService.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/samples/Alarm/src/com/example/android/newalarm/AlarmService.java b/samples/Alarm/src/com/example/android/newalarm/AlarmService.java
index 1f882069d..ec3163cb8 100644
--- a/samples/Alarm/src/com/example/android/newalarm/AlarmService.java
+++ b/samples/Alarm/src/com/example/android/newalarm/AlarmService.java
@@ -181,13 +181,6 @@ public class AlarmService extends Service {
// Sets the text to use for the status bar and status list views.
CharSequence notificationText = getText(R.string.alarm_service_started);
- // Sets the icon, status bar text, and display time for the mNotification.
- mNotification = new Notification(
- R.drawable.stat_sample, // the status icon
- notificationText, // the status text
- System.currentTimeMillis() // the time stamp
- );
-
// Sets up the Intent that starts AlarmActivity
mContentIntent = PendingIntent.getActivity(
this, // Start the Activity in the current context
@@ -196,14 +189,15 @@ public class AlarmService extends Service {
0 // Use an existing activity instance if available
);
- // Creates a new content view for the mNotification. The view appears when the user
- // shows the expanded status window.
- mNotification.setLatestEventInfo(
- this, // Put the content view in the current context
- getText(R.string.alarm_service_label), // The text to use as the label of the entry
- notificationText, // The text to use as the contents of the entry
- mContentIntent // The intent to send when the entry is clicked
- );
+ // Build the notification object.
+ mNotification = new Notification.Builder(this) // The builder requires the context
+ .setSmallIcon(R.drawable.stat_sample) // the status icon
+ .setTicker(notificationText) // the status text
+ .setWhen(System.currentTimeMillis()) // the time stamp
+ .setContentTitle(getText(R.string.alarm_service_label)) // the label of the entry
+ .setContentText(notificationText) // the contents of the entry
+ .setContentIntent(mContentIntent) // The intent to send when the entry is clicked
+ .build();
// Sets a unique ID for the notification and sends it to NotificationManager to be
// displayed. The ID is the integer marker for the notification string, which is