Skip to content

Commit d91deea

Browse files
Ricardo CerveraAndroid (Google) Code Review
authored andcommitted
Merge "docs: Fixed notification background bug. Bug: 16801684" into klp-modular-docs
2 parents e7c7993 + 69e9fcb commit d91deea

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

docs/html/training/wearables/notifications/creating.jd

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,12 @@ NotificationCompat.Builder notificationBuilder =
208208
<b>.setStyle(bigStyle);</b>
209209
</pre>
210210

211-
<p>Notice that you can add a large background image to any notification using the
211+
<p>Notice that you can add a large icon image to any notification using the
212212
{@link android.support.v4.app.NotificationCompat.Builder#setLargeIcon setLargeIcon()}
213-
method. For more information about designing notifications with large images, see the
213+
method. However, these icons appear as large background images on a wearable and do not look
214+
good as they are scaled up to fit the wearable screen. To add a wearable-specific background image
215+
to a notification, see <a href="#AddWearableFeatures">Add Wearable Features For a Notification</a>.
216+
For more information about designing notifications with large images, see the
214217
<a href="{@docRoot}design/wear/index.html">Design Principles of Android
215218
Wear</a>.</p>
216219

@@ -244,7 +247,8 @@ method to remove the app icon from the notification card.
244247
// Create a WearableExtender to add functionality for wearables
245248
NotificationCompat.WearableExtender wearableExtender =
246249
new NotificationCompat.WearableExtender()
247-
.setHintHideIcon(true);
250+
.setHintHideIcon(true)
251+
.setBackground(mBitmap);
248252

249253
// Create a NotificationCompat.Builder to build a standard notification
250254
// then extend it with the WearableExtender
@@ -257,12 +261,21 @@ Notification notif = new NotificationCompat.Builder(mContext)
257261
</pre>
258262

259263
<p>The
260-
{@link android.support.v4.app.NotificationCompat.WearableExtender#setHintHideIcon setHintHideIcon()}
261-
method is just one example of new notification features available with
262-
{@link android.support.v4.app.NotificationCompat.WearableExtender}.
263-
</p>
264-
265-
<p>If you ever need to read wearable-specifc options at a later time, use the corresponding get
264+
{@link android.support.v4.app.NotificationCompat.WearableExtender#setHintHideIcon setHintHideIcon()}
265+
and {@link android.support.v4.app.NotificationCompat.WearableExtender#setBackground setBackground()}
266+
methods are just two examples of new notification features available with
267+
{@link android.support.v4.app.NotificationCompat.WearableExtender}.</p>
268+
269+
<p class="note"><strong>Note:</strong> The bitmap that you use with
270+
{@link android.support.v4.app.NotificationCompat.WearableExtender#setBackground setBackground()}
271+
should have a resolution of 400x400 for non-scrolling backgrounds and 640x400 for backgrounds
272+
that support parallax scrolling. Place these bitmap images in the <code>res/drawable-nodpi</code>
273+
directory of your handheld app. Place other non-bitmap resources for wearable notifications, such
274+
as those used with the
275+
{@link android.support.v4.app.NotificationCompat.WearableExtender#setContentIcon setContentIcon()}
276+
method, in the <code>res/drawable-hdpi</code> directory of your handheld app.</p>
277+
278+
<p>If you ever need to read wearable-specific options at a later time, use the corresponding get
266279
method for the option. This example calls the
267280
{@link android.support.v4.app.NotificationCompat.WearableExtender#getHintHideIcon()} method to
268281
get whether or not this notification hides the icon:
@@ -272,6 +285,7 @@ NotificationCompat.WearableExtender wearableExtender =
272285
boolean hintHideIcon = wearableExtender.getHintHideIcon();
273286
</pre>
274287

288+
275289
<h2 id="Deliver">Deliver the Notification</h2>
276290
<p>When you want to deliver your notifications, always use the
277291
{@link android.support.v4.app.NotificationManagerCompat} API instead of

0 commit comments

Comments
 (0)