1page.title=What's New
2
3@jd:body
4
5<p>The following code samples were recently published. You can
6download them in the Android SDK Manager under the <b>SDK Samples</b> component
7for API 21.</p>
8
9<p class="note">
10  <strong>Note:</strong> The downloadable projects are designed
11   for use with Gradle and Android Studio.
12</p>
13
14<!-- NOTE TO EDITORS: add most recent samples first -->
15
16<h3 id="MediaBrowserService"><a href="/samples/MediaBrowserService/index.html">Media Browser Service</a></h3>
17
18<p>
19This sample is a simple audio media app that exposes its media
20library and provides metadata and playback controls through the new
21MediaBrowserService and MediaSession APIs from API 21.
22The sample is compatible with Android Auto and also provides a basic UI
23when not connected to a car.
24</p>
25
26<p class="note">
27  <strong>Note:</strong> This sample is compatible with <a
28  href="http://android.com/auto">Android Auto</a>.
29</p>
30
31
32<h3 id="MessagingService"><a href="/samples/MessagingService/index.html">Messaging Service</a></h3>
33
34<p>
35This sample shows a simple service that sends notifications using
36NotificationCompat. In addition to sending a notification, it also extends
37the notification with a CarExtender to make it compatible with Android Auto.
38Each unread conversation from a user is sent as a distinct notification.
39</p>
40
41<p class="note">
42  <strong>Note:</strong> This sample is compatible with <a
43  href="http://android.com/auto">Android Auto</a>.
44</p>
45
46
47<h3 id="SpeedTracker"><a href="/samples/SpeedTracker/index.html">Speed Tracker (Wear)</a></h3>
48
49<p>
50This sample uses the FusedLocation APIs of Google Play Services on Android Wear
51devices that have a hardware GPS built in. In those cases, this sample provides
52a simple screen that shows the current speed of the wearable device. User can
53set a speed limit and if the speed approaches that limit, it changes the color
54to yellow and if it exceeds the limit, it turns red. User can also enable
55recording of coordinates and when it pairs back with the phone, this data
56is synced with the phone component of the app and user can see a track
57made of those coordinates on a map on the phone.
58</p>
59
60
61<h3 id="AppRestrictionSchema"><a href="/samples/AppRestrictionSchema/index.html">AppRestrictionSchema</a></h3>
62
63<p>
64This sample shows how to use app restrictions. This application has one boolean
65restriction with a key "can_say_hello" that defines whether the only feature of this
66app (press the button to show "Hello" message) is enabled or disabled. Use
67AppRestrictionEnforcer sample to toggle the restriction.
68</p>
69
70
71<h3 id="AppRestrictionEnforcer"><a href="/samples/AppRestrictionEnforcer/index.html">AppRestrictionEnforcer</a></h3>
72
73<p>
74This sample demonstrates how to set restrictions to other apps as a profile owner.
75Use AppRestrictionSchema sample as a app with available restrictions.
76</p>
77
78
79<h3 id="DocumentCentricRelinquishIdentity"><a href="/samples/DocumentCentricRelinquishIdentity/index.html">DocumentCentricRelinquishIdentity</a></h3>
80
81<p>
82This sample shows how to relinquish identity to activities above it in the task stack.
83</p>
84
85
86<h3 id="DocumentCentricApps"><a href="/samples/DocumentCentricApps/index.html">DocumentCentricApps</a></h3>
87
88<p>
89This sample shows the basic usage of the new "Document Centric Apps" API.
90It let's you create new documents in the system overview menu and persists its
91state through reboots. If "Task per document" is checked a new task will be
92created for every new document in the overview menu.
93</p>
94
95
96<h3 id="HdrViewfinder"><a href="/samples/HdrViewfinder/index.html">HdrViewfinder</a></h3>
97
98<p>
99This demo implements a real-time high-dynamic-range camera viewfinder, by alternating
100the sensor's exposure time between two exposure values on even and odd frames, and then
101compositing together the latest two frames whenever a new frame is captured.
102</p>
103
104
105<h3 id="Interpolator"><a href="/samples/Interpolator/index.html">Interpolator</a></h3>
106
107<p>
108This sample demonstrates the use of animation interpolators and path animations for
109Material Design. It shows how an ObjectAnimator is used to animate two properties of a
110view (scale X and Y) along a path.
111</p>
112
113
114<h3 id="DrawableTinting"><a href="/samples/DrawableTinting/index.html">DrawableTinting</a></h3>
115
116<p>Sample that shows applying tinting and color filters to Drawables both programmatically
117and as Drawable resources in XML.</p>
118<p>Tinting is set on a nine-patch drawable through the "tint" and "tintMode" parameters.
119A color state list is referenced as the tint color, which defines colors for different
120states of a View (for example disabled/enabled, focused, pressed or selected).</p>
121<p>Programmatically, tinting is applied to a Drawable through its "setColorFilter" method,
122with a reference to a color and a PorterDuff blend mode. The color and blend mode can be
123changed from the UI to see the effect of different options.</p>
124
125
126<h3 id="LNotifications"><a href="/samples/LNotifications/index.html">LNotifications</a></h3>
127
128<p>
129This sample demonstrates how new features for notifications introduced in Android 5.0
130are used such as Heads-Up notifications, visibility, people, category and priority
131metadata. </p>
132
133
134<h3 id="CardView"><a href="/samples/CardView/index.html">CardView</a></h3>
135
136<p>
137This sample demonstrates how to use the CardView UI widget introduced in Android 5.0, using the support library for backward compatibility.
138</p>
139
140
141<h3 id="RecyclerView"><a href="/samples/RecyclerView/index.html">RecyclerView</a></h3>
142
143<p>
144Demonstration of using RecyclerView with a LayoutManager to create a vertical ListView.
145</p>
146
147
148<h3 id="RevealEffectBasic"><a href="/samples/RevealEffectBasic/index.html">RevealEffectBasic</a></h3>
149
150<p>
151A sample demonstrating how to perform a reveal effect for UI elements within the Material Design framework.
152</p>
153
154
155<h3 id="FloatingActionButtonBasic"><a href="/samples/FloatingActionButtonBasic/index.html">FloatingActionButtonBasic</a></h3>
156
157<p>
158This sample shows the two sizes of Floating Action Buttons and how to interact with
159them.
160</p>
161
162
163<!--
164<h3 id="">SampleName</h3>
165
166<div class="figure" style="width:220px">
167  <img src="" srcset="@2x.png 2x" alt="" height="375" />
168  <p class="img-caption">
169    <strong>Figure n.</strong> Single sentence summarizing the figure.
170  </p>
171</div>
172
173<p>
174**description**
175</p>
176-->
177
178<h3 id="JobSchedulerSample"><a href="/samples/JobScheduler/index.html">JobScheduler</a></h3>
179
180<p>
181This sample app allows the user to schedule jobs through the UI, and shows
182visual cues when the jobs are executed.
183</p>
184
185
186<h3 id="AndroidTVLeanbackSample"><a href="https://github.com/googlesamples/androidtv-leanback">AndroidTVLeanbackSample</a></h3>
187<!--
188<div class="figure" style="width:220px">
189  <img src="" srcset="@2x.png 2x" alt="" height="375" />
190  <p class="img-caption">
191    <strong>Figure n.</strong> Single sentence summarizing the figure.
192  </p>
193</div>
194-->
195
196<p>
197This sample demonstrates use of the Android TV Leanback Support Library.
198</p>
199
200<h3 id="Visual-Game-Controller"><a href="https://github.com/googlesamples/androidtv-VisualGameController">Visual-Game-Controller</a></h3>
201<!--
202<div class="figure" style="width:220px">
203  <img src="" srcset="@2x.png 2x" alt="" height="375" />
204  <p class="img-caption">
205    <strong>Figure n.</strong> Single sentence summarizing the figure.
206  </p>
207</div>
208-->
209
210<p>
211This sample displays events received from a game controller shown on the screen.
212</p>
213
214
215<h3 id="GameControllerSample"><a href="https://github.com/googlesamples/androidtv-GameController/">GameControllerSample</a></h3>
216<!--
217<div class="figure" style="width:220px">
218  <img src="" srcset="@2x.png 2x" alt="" height="375" />
219  <p class="img-caption">
220    <strong>Figure n.</strong> Single sentence summarizing the figure.
221  </p>
222</div>
223-->
224
225<p>
226This sample implements a multi-player game, demonstrating game controller input
227handling.
228</p>
229
230
231<h3 id="ClippingBasic"><a href="/samples/ClippingBasic/index.html">ClippingBasic</a></h3>
232<!--
233<div class="figure" style="width:220px">
234  <img src="" srcset="@2x.png 2x" alt="" height="375" />
235  <p class="img-caption">
236    <strong>Figure n.</strong> Single sentence summarizing the figure.
237  </p>
238</div>
239-->
240
241<p>
242This sample demonstrates clipping on a {@link android.view.View}.
243</p>
244
245<div class="figure" style="width:220px">
246  <img src="{@docRoot}samples/images/JobSchedulerSample.png"
247      srcset="{@docRoot}samples/images/JobSchedulerSample@2x.png 2x"
248      alt="" height="375" />
249  <p class="img-caption">
250    <strong>Figure 1.</strong> The JobSchedulerSample sample app.
251  </p>
252</div>
253
254
255<h3 id="ElevationDrag"><a href="/samples/ElevationDrag/index.html">ElevationDrag</a></h3>
256<!--
257<div class="figure" style="width:220px">
258  <img src="" srcset="@2x.png 2x" alt="" height="375" />
259  <p class="img-caption">
260    <strong>Figure n.</strong> Single sentence summarizing the figure.
261  </p>
262</div>
263-->
264
265<p>This sample demonstrates a drag and drop action on different shapes.
266Elevation and z-translation are used to render the shadows. The views are
267clipped using different outlines.</p>
268
269
270<h3 id="ElevationBasic"><a href="/samples/ElevationBasic/index.html">ElevationBasic</a></h3>
271<!--
272<div class="figure" style="width:220px">
273<img src="" srcset="@2x.png 2x" alt="" height="375" />
274    <p class="img-caption">
275    <strong>Figure n.</strong> Single sentence summarizing the figure.
276  </p>
277</div>
278-->
279
280<p>
281This sample demonstrates two alternative ways to move a view in the z-axis:</p>
282
283<ul>
284  <li>With a fixed elevation, using XML.</li>
285  <li>Raising the elevation when the user taps on it, using
286      <code>setTranslationZ()</code>.</li>
287</ul>
288
289
290<h3 id="ActivitySceneTransitionBasic"><a href="/samples/ActivitySceneTransitionBasic/index.html">ActivitySceneTransitionBasic</a></h3>
291<div class="figure" style="width:220px">
292  <img src="{@docRoot}samples/images/ActivitySceneTransitionBasic.png"
293      srcset="{@docRoot}samples/images/ActivitySceneTransitionBasic@2x.png 2x"
294      alt="" height="375" />
295  <p class="img-caption">
296    <strong>Figure 2.</strong> The ActivitySceneTransitionBasic sample app.
297  </p>
298  </div>
299
300<p> This sample demonstrates how to the use {@link android.app.Activity} scene
301transitions when transitioning from one activity to another. Uses a combination
302of <code>moveImage</code> and <code>changeBounds</code> to nicely transition
303from a grid of images to an activity with a large image and detail text. </p>
304
305
306<h3 id="Camera2Video"><a href="/samples/Camera2Video/index.html">Camera2Video</a></h3>
307<!--
308<div class="figure" style="width:220px">
309<img src="" srcset="@2x.png 2x" alt="" height="375" />
310    <p class="img-caption">
311    <strong>Figure n.</strong> Single sentence summarizing the figure.
312  </p>
313</div>
314-->
315
316<p>This sample demonstrates how to record video using the Camera2 API.</p>
317
318
319<h3 id="Camera2Basic"><a href="/samples/Camera2Basic/index.html">Camera2Basic</a></h3>
320
321<!--
322<div class="figure" style="width:220px">
323  <img src="" srcset="@2x.png 2x" alt="" height="375" />
324  <p class="img-caption">
325    <strong>Figure n.</strong> Single sentence summarizing the figure.
326  </p>
327</div>
328-->
329
330<p>This sample demonstrates the basic use of the Camera2 API. The sample code
331demonstrates how you can display camera preview and take pictures.</p>
332
333
334<h3 id="BasicManagedProfile"><a href="/samples/BasicManagedProfile/index.html">BasicManagedProfile</a></h3>
335<div class="figure" style="width:220px">
336  <img src="{@docRoot}samples/images/BasicManagedProfile.png"
337     srcset="{@docRoot}samples/images/BasicManagedProfile@2x.png 2x"
338     alt="" height="375" />
339  <p class="img-caption">
340    <strong>Figure 3.</strong> The BasicManagedProfile sample app.
341  </p>
342</div>
343
344<p>This sample demonstrates how to create a managed profile. You can also:</p>
345<ul>
346  <li>Enable or disable other apps, and set restrictions on them.</li>
347  <li>Configure intents to be forwarded between the primary account and the
348   managed profile.</li>
349  <li>Wipe all the data associated with the managed profile.</li>
350</ul>
351
352<p class="note"><strong>Note:</strong> There can be only one managed profile on
353  a device at a time.</p>
354
355