• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Android 5.1 APIs
2excludeFromSuggestions=true
3sdk.platform.version=5.1
4sdk.platform.apiLevel=22
5@jd:body
6
7
8<div id="qv-wrapper">
9<div id="qv">
10
11<h2>In this document
12    <a href="#" onclick="hideNestedItems('#toc44',this);return false;" class="header-toggle">
13        <span class="more">show more</span>
14        <span class="less" style="display:none">show less</span></a></h2>
15
16<ol id="toc44" class="hide-nested">
17  <li><a href="#ApiLevel">Update your target API level</a></li>
18
19  <li><a href="#multisim">Multiple SIM Card Support</a></li>
20  <li><a href="#http">Deprecated HTTP Classes</a></li>
21  <li><a href="#carrier">Carrier Services</a></li>
22</ol>
23
24<h2>API Differences</h2>
25<ol>
26<li><a href="{@docRoot}sdk/api_diff/22/changes.html">API level 21 to 22 &raquo;</a> </li>
27</ol>
28
29<h2>See Also</h2>
30<ol>
31<li><a href="{@docRoot}about/versions/lollipop.html">Android Lollipop Highlights</a> </li>
32</ol>
33
34
35</div>
36</div>
37
38<p>API Level: {@sdkPlatformApiLevel}</p>
39
40<p>
41  Android 5.1
42  (<a href="{@docRoot}reference/android/os/Build.VERSION_CODES.html#LOLLIPOP_MR1">LOLLIPOP_MR1</a>)
43  is an update to the Lollipop release that offers new features for users and app developers.
44  This document provides an introduction to the most notable new APIs.
45</p>
46
47<p>
48  For a high-level look at the new platform features, see the <a href=
49  "{@docRoot}about/versions/lollipop.html">Android Lollipop highlights</a>.
50</p>
51
52
53<h3 id="ApiLevel">Update your target API level</h3>
54
55<p>
56  To start building apps for Android 5.1, use the
57  <a href="{@docRoot}tools/help/sdk-manager.html">SDK Manager</a> to download the Android 5.1 SDK
58  Platform and System Images. Then set your app development project to use a
59  <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a>
60  of <code>"{@sdkPlatformApiLevel}"</code>. Install your app on an Android {@sdkPlatformVersion}
61  system image, test it, then publish the updated app with this change.
62</p>
63
64<p>
65  You can use Android {@sdkPlatformVersion} APIs while also supporting older versions by adding
66  conditions to your code that check for the system API level before executing APIs not supported
67  by your <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
68  minSdkVersion}</a>. To learn more about maintaining backward compatibility, read <a href=
69  "{@docRoot}training/basics/supporting-devices/platforms.html">Supporting Different Platform
70  Versions</a>.
71</p>
72
73<p>
74  For more information about how API levels work, read <a href=
75  "{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">What is API Level?</a>
76</p>
77
78<h2 id="multisim">Multiple SIM Card Support</h2>
79
80<p>
81  Android 5.1 adds support for using more than one cellular carrier SIM card at a time. This
82  feature lets users activate and use additional SIMs on devices that have two or more SIM card
83  slots.
84</p>
85
86<p>
87  You can access information about the currently active SIM through the {@link
88  android.telephony.SubscriptionManager} class, including whether or not the device is considered
89  to be roaming on the current network. This information is useful for developers who want to
90  throttle their apps' data access down or off for device users who are sensitive to data access
91  charges. Your app can be alerted to changes in a device's current network connection by
92  requesting the {@link android.Manifest.permission#READ_PHONE_STATE} permission and setting {@link
93  android.telephony.SubscriptionManager.OnSubscriptionsChangedListener} on the {@link
94  android.telephony.SubscriptionManager} object.
95</p>
96
97
98<h2 id="http">Deprecated HTTP Classes</h2>
99
100<p>
101  The {@code org.apache.http} classes and the {@code android.net.http.AndroidHttpClient} class
102  have been deprecated in Android 5.1. These classes are no longer being maintained and you should
103  migrate any app code using these APIs to the {@link java.net.URLConnection} classes as soon as
104  possible.
105</p>
106
107
108<h2 id="carrier">Carrier Services</h2>
109
110<p>
111  Android 5.1 provides support for telecommunication service providers to create apps that can
112  perform carrier provisioning tasks on an Android device. These APIs provide a secure and flexible
113  way for carrier-developed apps to perform these tasks and be distributed through Google Play. Apps
114  that use these functions must be signed by a certificate that matches the certificate in the
115  device's Universal Integrated Circuit Card (UICC).
116</p>
117
118<p>
119  The carrier service APIs have been added to the {@link android.telephony.TelephonyManager} class,
120  the {@link android.telephony.SmsManager} class, and the new {@link
121  android.service.carrier.CarrierMessagingService} class. Apps can check for access to these APIs
122  by calling the {@link android.telephony.TelephonyManager#hasCarrierPrivileges} method. Apps that
123  call these APIs without access receive a {@link java.lang.SecurityException}.
124</p>
125