1page.title=範例 2page.tags="preview", "samples", "android" 3page.image=images/cards/card-n-samples_2x.png 4@jd:body 5 6<p> 7 下列程式碼範例是針對 Android N 提供。如果要在 Android Studio 中下載, 範例,請選取 [File] > [Import Samples]<b></b> 選單選項。 8 9 10</p> 11 12<p class="note"> 13 <strong>注意:</strong>這些可下載的專案是專為與 Gradle 和 Android Studio 一起使用而設計。 14 15</p> 16 17 18<h3 id="mw">多視窗 Playground</h3> 19<img src="{@docRoot}images/android-7.0/sample-multiwindow.png" style="float: left; padding-right: 0.5em" height="250" width="156" /> 20<p> 21 此範例示範如何在您的應用程式中發揮多視窗使用者介面的功能。 22 23</p> 24<p> 25 <a href="https://github.com/googlesamples/android-MultiWindowPlayground">在 GitHub 上取得</a> 26 27</p> 28 29<div style="clear: both;"></div> 30<h3 id="an">使用中通知</h3> 31<img src="{@docRoot}images/android-7.0/sample-activenotifications.png" style="float: left; padding-right: 0.5em" height="250" width="141" /> 32<p> 33 這是現有的範例,它會顯示使用 NotificationCompat 傳送通知的簡單服務。來自使用者的每個未閱讀交談都會以個別通知方式傳送。 34 35 36</p> 37<p> 38 已更新此範例以利用 Android N 中的新通知功能。 39 40</p> 41<p> 42 <a href="https://github.com/googlesamples/android-ActiveNotifications">在 GitHub 上取得</a> 43 44</p> 45 46<div style="clear: both;"></div> 47<h3 id="ms">簡訊服務</h3> 48<img src="{@docRoot}images/android-7.0/sample-messagingservice.png" style="float: left; padding-right: 0.5em" height="250" width="150" /> 49<p> 50 這是現有的範例,它示範如何使用 NotificationManager 告知使用者應用程式目前顯示的通知數目。 51 52 53</p> 54<p> 55 已更新此範例以利用 Android N 中的新通知功能。 56 57</p> 58<p> 59 <a href="https://github.com/googlesamples/android-MessagingService">在 GitHub 上取得</a> 60 61</p> 62 63<div style="clear: both;"></div> 64<h3 id="fbe">直接開機</h3> 65<img src="{@docRoot}images/android-7.0/sample-directboot.png" style="float: left; padding-right: 0.5em" height="250" width="141" /> 66<p> 67 此範例示範如何在裝置加密的儲存空間 (裝置開機後即一律可用) 中儲存及存取資料。 68 69</p> 70<p> 71 <a href="https://github.com/googlesamples/android-DirectBoot">在 GitHub 上取得</a> 72 73</p> 74 75<div style="clear: both;"></div> 76<h3 id="sda">限定範圍目錄存取</h3> 77<img src="{@docRoot}images/android-7.0/sample-scopeddirectoryaccess.png" style="float: left; padding-right: 0.5em" height="250" width="141" /> 78<p> 79 此範例示範如何讀取及寫入特定目錄的資料,同時要求較少的權限。 80 81</p> 82<p> 83 <a href="https://github.com/googlesamples/android-ScopedDirectoryAccess">在 GitHub 上取得</a> 84 85</p> 86