diff options
Diffstat (limited to 'docs/html/training')
-rw-r--r-- | docs/html/training/building-location.jd | 11 | ||||
-rw-r--r-- | docs/html/training/building-wearables.jd | 4 | ||||
-rw-r--r-- | docs/html/training/maps/index.jd | 70 | ||||
-rw-r--r-- | docs/html/training/material/index.jd | 4 | ||||
-rw-r--r-- | docs/html/training/monetization/ads-and-ux.jd | 250 | ||||
-rw-r--r-- | docs/html/training/monetization/index.jd | 44 | ||||
-rw-r--r-- | docs/html/training/safetynet/index.jd | 370 | ||||
-rw-r--r-- | docs/html/training/sign-in/index.jd | 68 | ||||
-rw-r--r-- | docs/html/training/training_toc.cs | 123 | ||||
-rw-r--r-- | docs/html/training/tv/start/start.jd | 2 |
10 files changed, 589 insertions, 357 deletions
diff --git a/docs/html/training/building-location.jd b/docs/html/training/building-location.jd new file mode 100644 index 0000000..9ab0908 --- /dev/null +++ b/docs/html/training/building-location.jd @@ -0,0 +1,11 @@ +page.title=Building Apps with Location & Maps +page.trainingcourse=true + +@jd:body + + +<p> + These classes teach you how to add user location and mapping information to your app. + Make your app more helpful and relevant to users by providing information about where + they are and the world around them. +</p>
\ No newline at end of file diff --git a/docs/html/training/building-wearables.jd b/docs/html/training/building-wearables.jd index 8015d0c..c9e1856 100644 --- a/docs/html/training/building-wearables.jd +++ b/docs/html/training/building-wearables.jd @@ -1,6 +1,6 @@ page.title=Building Apps for Wearables page.trainingcourse=true -page.image=wear/images/notifications.png +page.image=images/cards/android-wear-apps_2x.jpg page.metaDescription=Learn how to build notifications, send and sync data, and use voice actions. @jd:body @@ -11,4 +11,4 @@ synced to wearables as well as how to build apps that run on wearables.</p> <p class="note"><strong>Note:</strong> For more information about the APIs used in these training classes, see the <a href="{@docRoot}reference/packages-wearable-support.html">Wear API reference -documentation</a>.</p>
\ No newline at end of file +documentation</a>.</p> diff --git a/docs/html/training/maps/index.jd b/docs/html/training/maps/index.jd new file mode 100644 index 0000000..3efa493 --- /dev/null +++ b/docs/html/training/maps/index.jd @@ -0,0 +1,70 @@ +page.title=Adding Maps +page.tags=mapview,location +page.article=true +page.trainingcourse=true +@jd:body + + +<img src="{@docRoot}images/google/gps-maps.png" + width="300" + style="float:right;margin:0 0 20px 20px" + alt="Google maps sample image"> + +<p> + Allow your users to explore the world with rich maps provided by Google. Identify + locations with custom markers, augment the map data with image overlays, embed one + or more maps as fragments, and much more. +</p> + +<p> + The <a href="https://developers.google.com/maps/documentation/android/">Google + Maps Android API</a> allows you to include maps and customized mapping information + in your app. +</p> + + +<h2 id="features">Key Developer Features</h2> + +<h4>Add maps to your app</h4> +<p> + With Google Maps Android API v2, you can embed maps into an activity as a fragment with a simple + XML snippet. The new Maps offer exciting features such as 3D maps; indoor, satellite, terrain, + and hybrid maps; vector-based tiles for efficient caching and drawing; animated transitions; and + much more. <a class="external-link" href= + "https://developers.google.com/maps/documentation/android/map">Add a map object</a>. +</p> + +<h4>Customize the map</h4> +<p> + Add markers onto the map to indicate special points of interest for your users. You can define + custom colors or icons for your map markers to match your app's look and feel. To further enhance + the app, draw polylines and polygons to indicate paths or regions, or provide complete image + overlays. <a class="external-link" href= + "https://developers.google.com/maps/documentation/android/marker">Draw markers</a>. +</p> + +<h4>Control the user's view</h4> +<p> + Give your users a different view of the world with the ability to control the rotation, tilt, + zoom, and pan properties of the "camera" perspective of the map. <a class="external-link" href= + "https://developers.google.com/maps/documentation/android/views">Change the view</a>. +</p> + +<h4>Add Street View to your app</h4> +<p> + Embed Street View into an activity and let your users explore the world through panoramic + 360-degree views. Programmatically control the zoom and orientation (tilt and bearing) of the + Street View camera, and animate the camera movements over a given duration. <a class= + "external-link" href="https://developers.google.com/maps/documentation/android/streetview">Add + Street View</a>. +</p> + + +<h2 id="start">Get Started</h2> +<p> + Google Maps Android API is part of the Google Play services platform. To use Google Maps, + set up the Google Play services SDK in your app development project. For more information, + see the <a class="external-link" + href="https://developers.google.com/maps/documentation/android/start">Getting Started</a> guide + for the Google Maps Android API. +</p> diff --git a/docs/html/training/material/index.jd b/docs/html/training/material/index.jd index 7cbd777..6e07860 100644 --- a/docs/html/training/material/index.jd +++ b/docs/html/training/material/index.jd @@ -1,6 +1,6 @@ -page.title=Creating Apps with Material Design +page.title=Material Design for Developers page.type=design -page.image=images/material.png +page.image=images/cards/material_2x.png page.metaDescription=Learn how to apply material design to your apps. diff --git a/docs/html/training/monetization/ads-and-ux.jd b/docs/html/training/monetization/ads-and-ux.jd deleted file mode 100644 index d3ab676..0000000 --- a/docs/html/training/monetization/ads-and-ux.jd +++ /dev/null @@ -1,250 +0,0 @@ -page.title=Advertising without Compromising User Experience -parent.title=Monetizing Your App -parent.link=index.html -@jd:body - - -<!-- This is the training bar --> -<div id="tb-wrapper"> -<div id="tb"> - -<h2>This lesson teaches you to</h2> -<ol> - <li><a href="#ObtainPubAccountAndSDK">Obtain a Publisher Account and Ad SDK</a></li> - <li><a href="#DeclarePermissions">Declare Proper Permissions</a></li> - <li><a href="#SetupAdPlacement">Set Up Ad Placement</a></li> - <li><a href="#InitializeAd">Initialize the Ad</a></li> - <li><a href="#EnableTestMode">Enable Test Mode</a></li> - <li><a href="#ImplementListeners">Implement Ad Event Listeners</a></li> -</ol> - -<h2>You should also read</h2> -<ul> - <li><a href="http://code.google.com/mobile/ads/">AdMob SDK</a></li> -</ul> - - -<h2>Try it out</h2> - -<div class="download-box"> - <a href="http://developer.android.com/shareables/training/MobileAds.zip" class="button">Download -the sample app</a> - <p class="filename">MobileAds.zip</p> -</div> - - -</div> -</div> - -<p>Advertising is one of the means to monetize (make money with) mobile applications. In this -lesson, you are going to learn how to incorporate banner ads in your Android application.</p> - -<p>While this lesson and the sample application use <a -href="http://code.google.com/mobile/ads/">AdMob</a> to serve ads, the Android platform doesn’t -impose any restrictions on the choice of mobile advertising network. To the extent possible, this -lesson generically highlights concepts that are similar across advertising networks.</p> - -<p>For example, each advertising network may have some network-specific configuration settings such -as geo-targeting and ad-text font size, which may be configurable on some networks but not on -others. This lesson does not touch not these topics in depth and you should consult documentation -provided by the network you choose.</p> - - -<h2 id="ObtainPubAccountAndSDK">Obtain a Publisher Account and Ad SDK</h2> - -<p>In order to integrate advertisements in your application, you first must become a publisher by -registering a publishing account with the mobile advertising network. Typically, an identifier is -provisioned for each application serving advertisements. This is how the advertising network -correlates advertisements served in applications. In the case of AdMob, the identifier is known as -the Publisher ID. You should consult your advertising networks for details.</p> - -<p>Mobile advertising networks typically distribute a specific Android SDK, which consists of code -that takes care of communication, ad refresh, look-and-feel customization, and so on.</p> - -<p>Most advertising networks distribute their SDK as a JAR file. Setting up ad network JAR file in -your Android project is no different from integrating any third-party JAR files. First, copy the -JAR files to the <code>libs/</code> directory of your project. If you’re using Eclipse as IDE, be -sure to add the JAR file to the Build Path. It can be done through <b>Properties > -Java Build Path > Libraries > Add JARs</b>.</p> - -<img src="/images/training/ads-eclipse-build-path.png" id="figure1" /> -<p class="img-caption"> - <strong>Figure 1.</strong> Eclipse build path settings. -</p> - - -<h2 id="DeclarePermissions">Declare Proper Permissions</h2> - -<p>Because the mobile ads are fetched over the network, mobile advertising SDKs usually -require the declaration of related permissions in the Android manifest. Other kinds of permissions -may also be required.</p> - -<p>For example, here's how you can request the {@link android.Manifest.permission#INTERNET} -permission:</p> - -<pre> -</manifest> - <uses-permission android:name="android.permission.INTERNET" /> - ... - <application>...</application> -</manifest> -</pre> - - -<h2 id="SetupAdPlacement">Set Up Ad Placement</h2> - -<div class="figure" style="width:262px"> -<img src="/images/training/ads-top-banner.png" id="figure2" /> -<p class="img-caption"> - <strong>Figure 2.</strong> Screenshot of the ad layout in the Mobile Ads sample. -</p> -</div> - -<p>Banner ads typically are implemented as a custom {@link android.webkit.WebView} (a view for -viewing web pages). Ads also come in different dimensions and shapes. Once you’ve decided to put an -ad on a particular screen, you can add it in your activity's XML layout. The XML snippet below -illustrates a banner ad displayed on top of a screen.</p> - -<pre> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/ad_catalog_layout" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" > - <com.google.ads.AdView - xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads" - android:id="@+id/ad" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - googleads:adSize="BANNER" - googleads:adUnitId="@string/admob_id" /> - <TextView android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/banner_top" /> - <TextView android:id="@+id/status" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> -</LinearLayout> -</pre> - -<p>You should consider using alternative ad sizes based on various configurations such as screen -size or screen orientation. This can easily be addressed by <a -href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">providing -alternative resources</a>. For instance, the above sample layout might placed under the -<code>res/layout/</code> directory as the default layout. If larger ad -sizes are available, you can consider using them for "large" (and above) screens. For example, the -following snippet comes from a layout file in the <code>res/layout-large/</code> directory, which -renders a larger ad for "large" screen sizes.</p> - -<pre> -... -<com.google.ads.AdView - xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads" - android:id="@+id/ad" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - <strong>googleads:adSize="IAB_LEADERBOARD"</strong> - googleads:adUnitId="@string/admob_id" /> -... -</pre> - -<p>Notice that the custom view name and it’s configuration attributes are network-specific. Ad -networks might support configurations with XML layout attributes (as shown above), runtime APIs, or -both. In the sample application, Mobile Ads, the {@code AdView} ad size -(<code>googleads:adSize</code>) and publisher ID (<code>googleads:adUnitId</code>) are set up in the -XML layout.</p> - -<p>When deciding where to place ads within your application, you should carefully -consider user-experience. For example, you don’t want to fill the screen with -multiple ads that will quite likely annoy your users. In fact, this practice is banned by some ad -networks. Also, avoid placing ads too closely to UI controls to avoid inadvertent clicks.</p> - -<p>Figures 3 and 4 illustrate what <strong>not</strong> to do.</p> - -<div style="float:left;width:275px"> -<img src="/images/training/ads-close-to-button.png" /> -<p class="img-caption"> - <strong>Figure 3.</strong> Avoid putting UI -inputs too closely to an ad banner to prevent inadvertent ad clicks. -</p> -</div> - -<div style="float:left;width:275px;height:530px;margin-left:2em"> -<img src="/images/training/ads-cover-content.png" /> -<p class="img-caption"> - <strong>Figure 4.</strong> Don't overlay ad banner on useful content. -</p> -</div> - - -<h2 id="InitializeAd" style="clear:left">Initialize the Ad</h2> - -<p>After setting up the ad in the XML layout, you can further customize the ad in {@link -android.app.Activity#onCreate Activity.onCreate()} or {@link -android.app.Fragment#onCreateView Fragment.onCreateView()} based on how your application is -architected. Depending on the ad network, possible configuration parameters are: ad size, font -color, keyword, demographics, location targeting, and so on.</p> - -<p>It is important to respect user privacy if certain parameters, such as demographics or location, -are passed to ad networks for targeting purposes. Let your users know and give them a chance to opt -out of these features.</p> - -<p>In the below code snippet, keyword targeting is used. After the keywords are set, the -application calls <code>loadAd()</code> to begin serving ads.</p> - -<pre> -public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - ... - View v = inflater.inflate(R.layout.main, container, false); - mAdStatus = (TextView) v.findViewById(R.id.status); - mAdView = (AdView) v.findViewById(R.id.ad); - mAdView.setAdListener(new MyAdListener()); - - AdRequest adRequest = new AdRequest(); - adRequest.addKeyword("sporting goods"); - mAdView.loadAd(adRequest); - return v; -} -</pre> - - - -<h2 id="EnableTestMode">Enable Test Mode</h2> - -<p>Some ad networks provide a test mode. This is useful during development and testing in which ad -impressions and clicks are not counted.</p> - -<p class="caution"><strong>Important:</strong> Be sure to turn off test mode before publishing your -application.</p> - - -<h2 id="ImplementListeners">Implement Ad Event Listeners</h2> - -<p>Where available, you should consider implementing ad event listeners, which provide callbacks on -various ad-serving events associated with the ad view. Depending on the ad network, the listener -might provide notifications on events such as before the ad is loaded, after the ad is loaded, -whether the ad fails to load, or other events. You can choose to react to these events based on -your specific situation. For example, if the ad fails to load, you can display a custom banner -within the application or create a layout such that the rest of content fills up the screen.</p> - -<p>For example, here are some event callbacks available from AdMob's {@code AdListener} -interface:</p> - -<pre> -private class MyAdListener implements AdListener { - ... - - @Override - public void onFailedToReceiveAd(Ad ad, ErrorCode errorCode) { - mAdStatus.setText(R.string.error_receive_ad); - } - - @Override - public void onReceiveAd(Ad ad) { - mAdStatus.setText(""); - } -} -</pre> - diff --git a/docs/html/training/monetization/index.jd b/docs/html/training/monetization/index.jd deleted file mode 100644 index f90bfc7..0000000 --- a/docs/html/training/monetization/index.jd +++ /dev/null @@ -1,44 +0,0 @@ -page.title=Monetizing Your App - -trainingnavtop=true -startpage=true -next.title=Advertising without Compromising User Experience -next.link=ads-and-ux.html - -@jd:body - -<div id="tb-wrapper"> -<div id="tb"> - -<!-- Required platform, tools, add-ons, devices, knowledge, etc. --> -<h2>Dependencies and prerequisites</h2> -<ul> - <li>Android 1.0 or higher</li> - <li>Experience with <a href="{@docRoot}guide/topics/ui/declaring-layout.html">XML layouts</a></li> -</ul> - - -<h2>Try it out</h2> - -<div class="download-box"> - <a href="http://developer.android.com/shareables/training/MobileAds.zip" class="button">Download -the sample app</a> - <p class="filename">MobileAds.zip</p> -</div> - -</div> -</div> - -<p>Apart from offering paid apps, there are a number of other ways to monetize your mobile applications. In this class, we are going to examine a number of typical methods (more lessons are to come) and their associated technical best practices. Obviously, each application is different and you should experiment with different combinations of these and other monetization methods to determine what works best for you.</p> - -<h2>Lessons</h2> - -<!-- Create a list of the lessons in this class along with a short description of each lesson. -These should be short and to the point. It should be clear from reading the summary whether someone -will want to jump to a lesson or not.--> - -<dl> - <dt><b><a href="ads-and-ux.html">Advertising without Compromising User Experience</a></b></dt> - <dd>In this lesson, you will learn how to monetize your application with mobile -advertisements.</dd> -</dl> diff --git a/docs/html/training/safetynet/index.jd b/docs/html/training/safetynet/index.jd new file mode 100644 index 0000000..6090f41 --- /dev/null +++ b/docs/html/training/safetynet/index.jd @@ -0,0 +1,370 @@ +page.title=Checking Device Compatibility with SafetyNet + +@jd:body + + +<div id="tb-wrapper"> +<div id="tb"> + + <h2>In this document</h2> + <ol> + <li><a href="#tos">Additional Terms of Service</a></li> + <li><a href="#connect-play">Connect to Play Services</a></li> + <li><a href="#cts-check">Requesting a Compatibility Check</a> + <ol> + <li><a href="#single-use-token">Obtain Single Use Token</a></li> + <li><a href="#compat-check-request">Send Compatibility Check Request</a></li> + <li><a href="#compat-check-response">Read Compatibility Check Response</a></li> + <li><a href="#verify-compat-check">Verify Compatibility Check Response</a></li> + </ol> + </li> + </ol> + +</div> +</div> + +<p> + SafetyNet provides services for analyzing the configuration of a particular device, to make sure + that apps function properly on a particular device and that users have a great experience. +</p> + +<p> + The service provides an API your app can use to analyze the device where it is installed. The API + uses software and hardware information on the device where your app is installed to create a + profile of that device. The service then attempts to match it to a list of device models that + have passed Android compatibility testing. This check can help you decide if the device is + configured in a way that is consistent with the Android platform specifications and has the + capabilities to run your app. +</p> + +<p> + This document shows you how to use SafetyNet for analyzing a device and help you determine if + your app will function as expected on that device. +</p> + +<h2 id="tos"> + Additional Terms of Service +</h2> + +<p> + By accessing or using the SafetyNet APIs, you agree to the <a href= + "https://developers.google.com/terms/">Google APIs Terms of Service</a>, and to these Additional + Terms. Please read and understand all applicable terms and policies before accessing the APIs. +</p> + +<div class="sdk-terms" onfocus="this.blur()" style="width:678px"> +<h3 class="norule">SafetyNet Terms of Service</h3> +As with any data collected in large volume from in-the-field observation, there is a chance of +both false positives and false negatives. We are presenting the data to the best of our +understanding. We extensively test our detection mechanisms to ensure accuracy, and we are +committed to improving those methods over time to ensure they continue to remain accurate. + +You agree to comply with all applicable law, regulation, and third party rights (including +without limitation laws regarding the import or export of data or software, privacy, and local +laws). You will not use the APIs to encourage or promote illegal activity or violation of third +party rights. You will not violate any other terms of service with Google (or its affiliates). + +You acknowledge and understand that the SafetyNet API works by collecting hardware and software +information, such as device and application data and the results of integrity checks, and sending +that data to Google for analysis. Pursuant to Section 3(d) of the +<a href= "https://developers.google.com/terms/">Google APIs Terms of Service</a>, you agree that if +you use the APIs that it is your responsibility to provide any necessary notices or consents for the +collection and sharing of this data with Google. +</div> + +<h2 id="connect-play"> + Connect to Google Play Services +</h2> + +<p> + The SafetyNet API is part of Google Play services. To connect to the API, you need to create an + instance of the Google Play services API client. For details about using the client in your app, + see <a href="{@docRoot}google/auth/api-client.html#Starting">Accessing Google + APIs</a>. Once you have established a connection to Google Play services, you can use the Google + API client classes to connect to the SafetyNet API. +</p> + +<p> + To connect to the API, in your activity's <a href= + "{@docRoot}reference/android/app/Activity.html#onCreate(android.os.Bundle)">onCreate()</a> + method, create an instance of Google API Client using <a href= + "{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html"> + {@code GoogleApiClient.Builder}</a>. Use the builder to add the SafetyNet API, as shown in the + following code example: +</p> + +<pre> +protected synchronized void buildGoogleApiClient() { + mGoogleApiClient = new GoogleApiClient.Builder(this) + .addApi(SafetyNet.API) + .addConnectionCallbacks(myMainActivity.this) + .build(); +} +</pre> + +<p class="note"> + <strong>Note:</strong> You can only call these methods after your app has established a connection to + Google Play services by receiving the <a href= + "{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)"> + {@code onConnected()}</a> callback. For details about listening for a completed client connection, + see <a href="{@docRoot}google/auth/api-client.html#Starting">Accessing Google APIs</a>. +</p> + +<h2 id="cts-check"> + Requesting a Compatibility Check +</h2> + +<p> + A SafetyNet compatibility check allows your app to check if the device where it is running + matches the profile of a device that has passed Android compatibility testing. The compatibility + check creates a device profile by gathering information about the device hardware and software + characteristics, including the platform build. +</p> + +<p> + Using the API to perform a check requires a few implementation steps in your app. Once you have + established a connection to Google Play services and requested the SafetyNet API from the Google + API client, your app can then perform the following steps to use the service: +</p> + +<ul> + <li>Obtain a single use token + </li> + + <li>Send the compatibility check request + </li> + + <li>Read the response + </li> + + <li>Validate the response + </li> +</ul> + +<p> + For more information about Android compatibility testing, see <a href= + "https://source.android.com/compatibility/index.html" class="external-link"> + Android Compatibility</a> and the <a href= + "https://source.android.com/compatibility/cts-intro.html" class="external-link"> + Compatibility Testing Suite</a> (CTS). +</p> + +<p> + SafetyNet checks use network resources, and so the speed of responses to requests can vary, + depending on a device's network connection status. The code described in this section should be + executed outside of your app's main execution thread, to avoid pauses and unresponsiveness in + your app user interface. For more information about using separate execution threads, see + <a href="{@docRoot}training/multiple-threads/index.html">Sending Operations + to Multiple Threads</a>. +</p> + +<h3 id="single-use-token"> + Obtain a single use token +</h3> + +<p> + The SafetyNet API uses security techniques to help you verify the integrity of the communications + between your app and the service. When you request a compatibility check, you must provide a + single use token in the form of a number used once, or <em>nonce</em>, as part of your request. A + nonce is a random token generated in a cryptographically secure manner. +</p> + +<p> + You can obtain a nonce by generating one within your app each time you make a compatibility check + request. As a more secure option, you can obtain a nonce from your own server, using a secure + connection. +</p> + +<p> + A nonce used with a SafetyNet request should be at least 16 bytes in length. After you make a + check request, the response from the SafetyNet service includes your nonce, so you can verify it + against the one you sent. As the name indicates, you should only use a nonce value once, for a + single check request. Use a different nonce for any subsequent check requests. For tips on using + cryptography functions, see <a href= + "{@docRoot}training/articles/security-tips.html#Crypto">Security Tips</a>. +</p> + +<h3 id="compat-check-request"> + Send the compatibility check request +</h3> + +<p> + After you have established a connection to Google Play services and created a nonce, you are + ready to make a compatibility check request. Since the response to your request may not be + immediate, you set up a callback listener to catch the response from the service, as shown in the + following code example: +</p> + +<pre> +byte[] nonce = getRequestNonce(); // Should be at least 16 bytes in length. +SafetyNet.SafetyNetApi.attest(mGoogleApiClient, nonce) + .setResultCallback(new ResultCallback<SafetyNetApi.AttestationResult>() { + + @Override + public void onResult(SafetyNetApi.AttestationResult result) { + Status status = result.getStatus(); + if (status.isSuccess()) { + // Indicates communication with the service was successful. + // result.getJwsResult() contains the result data + } else { + // An error occurred while communicating with the service + } + } +}); +</pre> + +<p> + The <a href= + "{@docRoot}reference/com/google/android/gms/common/api/Status.html#isSuccess()"> + {@code isSuccess()}</a> + method indicates whether or not communication with the service was successful, but does not + indicate if the device has passed the compatibility check. The next section discusses how to read + the check result and verify its integrity. +</p> + +<h3 id="compat-check-response"> + Read the compatibility check response +</h3> + +<p> + When your app communicates with SafetyNet, the service provides a response containing the result + and additional information to help you verify the integrity of the message. The result is + provided as a <a href= + "{@docRoot}reference/com/google/android/gms/safetynet/SafetyNetApi.html"> + {@code AttestationResult}</a> + object. Use the <a href= + "{@docRoot}reference/com/google/android/gms/safetynet/SafetyNetApi.AttestationResult.html#getJwsResult()"> +{@code getJwsResult()}</a> method of this object to obtain the data of the request. The response is + formatted as a <a href="https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-36" class="external-link"> + JSON Web Signature</a> (JWS), the following JWS excerpt shows the format of the payload data: +</p> + +<pre> +{ +"nonce": "R2Rra24fVm5xa2Mg", +"timestampMs": 9860437986543, +"apkPackageName": "com.package.name.of.requesting.app", +"apkCertificateDigestSha256": ["base64 encoded, SHA-256 hash of the +certificate used to sign requesting app"], +"apkDigestSha256": "base64 encoded, SHA-256 hash of the app's APK", +"ctsProfileMatch": true, +} +</pre> + +<p> + If the value of {@code ctsProfileMatch} is {@code true}, this indicates that the device + profile matches a device that has passed Android compatibility testing. If the output of the + <a href= + "{@docRoot}reference/com/google/android/gms/safetynet/SafetyNetApi.AttestationResult.html#getJwsResult()"> +{@code getJwsResult()}</a> method is null or contains an {@code error:} field, then communication + with the service failed and should be retried. You should use an <a class="external-link" href= + "https://developers.google.com/api-client-library/java/google-http-java-client/backoff"> + exponential backoff</a> technique for retries, to avoid flooding the service with additional requests. +</p> + +<h3 id="verify-compat-check"> + Verify the compatibility check response +</h3> + +<p> + You should take steps to make sure the response received by your app actually came from the + SafetyNet service and matches the request data you provided. Follow these steps to verify the + origin of the JWS message: +</p> + +<ul> + <li>Extract the SSL certificate chain from the JWS message. + </li> + + <li>Validate the SSL certificate chain and use SSL hostname matching to verify that the leaf + certificate was issued to the hostname {@code attest.android.com}. + </li> + + <li>Use the certificate to verify the signature of the JWS message. + </li> +</ul> + +<p> + After completing this validation, you should also check the data of the JWS message to make sure + it matches your original request, including the nonce, timestamp, package name, and the SHA-256 + hashes. You can perform these validation steps within your app, or as a more secure option, send + the entire JWS response to your own server for verification, via a secure connection. +</p> + +<h4> + Validating the response with Google APIs +</h4> + +<p> + Google provides an Android Device Verification API for validating the output of the SafetyNet + compatibility check. This API performs a validation check on the JWS message returned from the + SafetyNet service. +</p> + +<p> + To enable access to the Android Device Verification API: +</p> + +<ol> + <li>Go to the <a href="https://console.developers.google.com/" class="external-link"> + Google Developers Console</a>. + </li> + + <li>Select a project, or create a new one. + </li> + + <li>In the sidebar on the left, expand <strong>APIs & auth</strong>. + Next, click <strong>APIs</strong>. In the + list of APIs, make sure all of the APIs you are using show a status of <strong>ON</strong>. + </li> + + <li>In the <strong>Browse APIs</strong> list, find the + <strong>Android Device Verification API</strong> and turn it + on. + </li> + + <li>Obtain your API key by expanding <strong>APIs & auth</strong> and + clicking <strong>Credentials</strong>. + Record the <strong>API KEY</strong> value on this page for later use. + </li> +</ol> + +<p> + After enabling this API for your project, you can call the verification service from your app or + server. You need the contents of the JWS message from the SafetyNet API and your API key to call + the verification API and get a result. +</p> + +<p> + To use the Android Device Verification API: +</p> + +<ol> + <li>Create a JSON message containing the entire contents of the JWS message in the following + format: +<pre> +{ "signedAttestation": "<output of getJwsResult()>" } +</pre> + </li> + + <li>Use an HTTP POST request to send the message with a Content-Type of {@code "application/json"} + to the following URL: +<pre> +https://www.googleapis.com/androidcheck/v1/attestations/verify?key=<your API key> +</pre> + </li> + + <li>The service validates the integrity of the message, and if the message is valid, it returns a + JSON message with the following contents: + +<pre> +{ “isValidSignature”: true } +</pre> + </li> +</ol> + +<p class="note"> + <strong>Important:</strong> This use of the Android Device Verification API only validates that the + provided JWS message was received from the SafetyNet service. It <em>does not</em> verify that the + payload data matches your original compatibility check request. +</p>
\ No newline at end of file diff --git a/docs/html/training/sign-in/index.jd b/docs/html/training/sign-in/index.jd new file mode 100644 index 0000000..9d49fd9 --- /dev/null +++ b/docs/html/training/sign-in/index.jd @@ -0,0 +1,68 @@ +page.title=Adding Sign-In +page.tags=authentication,signin,social,google+ +page.article=true +page.trainingcourse=true +@jd:body + + +<img src="{@docRoot}images/google/gps-googleplus.png" + width="300" + style="float:right;margin:0 0 20px 20px" + alt="Google maps sample image"> + +<p> + The Google+ platform for Android lets you authenticate a user with the same credentials they use + on Google every day. Once a user signs in with Google, you can create more engaging experiences + and drive usage of your app. +</p> + +<p> + The <a href="https://developers.google.com/+/mobile/android/">Google+ Android API</a> allows + you to integrate sign-in and social features into your app. +</p> + + +<h2 id="features">Key Developer Features</h2> + +<h4>Trusted authentication</h4> +<p> + Google+ Sign-In is a simple, trusted, and secure way to let people sign in to your app with their + Google credentials and bring along their Google+ info.<br> + <a href="https://developers.google.com/+/mobile/android/sign-in" class="external-link">Add + sign-in</a>. +</p> + +<h4>Access the profile and social graph</h4> +<p> + Once users have signed in with Google, your app can welcome them by name, display their picture, + connect them with friends, and lots more.<br> + <a href="https://developers.google.com/+/mobile/android/people" class="external-link">Access the + social graph</a>. +</p> + +<h4>Stand out in the stream</h4> +<p> + Interactive posts is a rich way of sharing to Google+. It lets users prompt friends to take + specific actions in your app from a Google+ post, like "listen," "RSVP," "check-in," and over 100 + more actions.<br> + <a class="external-link" href="https://developers.google.com/+/mobile/android/share">Post + interactive content</a>. +</p> + +<h4>Recommend content</h4> +<p> + Add a native +1 button so users can recommend content from your app. These endorsements can give + your app more credibility and help it grow faster.<br> + <a class="external-link" href="https://developers.google.com/+/mobile/android/recommend">Add the + +1 button</a>. +</p> + + +<h2 id="start">Get Started</h2> +<p> + The Google+ Android APIs are part of the Google Play services platform. To use Google+ features, + set up the Google Play services SDK in your app development project. For more information, see + the <a class="external-link" href= + "https://developers.google.com/+/mobile/android/getting-started">Getting Started</a> guide for + the Google+ Platform for Android +</p>
\ No newline at end of file diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs index 82d0a90..cefff81 100644 --- a/docs/html/training/training_toc.cs +++ b/docs/html/training/training_toc.cs @@ -672,12 +672,59 @@ include the action bar on devices running Android 2.1 or higher." <!-- End connectivity and cloud --> + <li class="nav-section"> + <div class="nav-section-header"> + <a href="<?cs var:toroot ?>training/building-location.html"> + <span class="small">Building Apps with</span><br/> + Location & Maps + </a> + </div> + <ul> + <li class="nav-section"> + <div class="nav-section-header"> + <a href="<?cs var:toroot ?>training/location/index.html" + description="How to add location-aware features to your app by getting the user's current location."> + Making Your App Location-Aware + </a> + </div> + <ul> + <li> + <a href="<?cs var:toroot ?>training/location/retrieve-current.html"> + Getting the Last Known Location + </a> + </li> + <li> + <a href="<?cs var:toroot ?>training/location/receive-location-updates.html"> + Receiving Location Updates + </a> + </li> + <li> + <a href="<?cs var:toroot ?>training/location/display-address.html"> + Displaying a Location Address + </a> + </li> + <li><a href="<?cs var:toroot ?>training/location/geofencing.html"> + Creating and Monitoring Geofences + </a> + </li> + </ul> + </li> + <li class="nav-section"> + <a href="<?cs var:toroot ?>training/maps/index.html" + description="How to add maps and mapping information to your app."> + Adding Maps + </a> + </li> + </ul> + </li> + <!-- End location and maps --> + <li class="nav-section"> <div class="nav-section-header"> <a href="<?cs var:toroot ?>training/building-userinfo.html"> <span class="small">Building Apps with</span><br/> - User Info & Location + User Info & Sign-In </a> </div> <ul> @@ -712,39 +759,15 @@ include the action bar on devices running Android 2.1 or higher." </li> </ul> </li> - <li class="nav-section"> - <div class="nav-section-header"> - <a href="<?cs var:toroot ?>training/location/index.html" - description="How to add location-aware features to your app by getting the user's current location."> - Making Your App Location-Aware - </a> - </div> - <ul> - <li> - <a href="<?cs var:toroot ?>training/location/retrieve-current.html"> - Getting the Last Known Location - </a> - </li> - <li> - <a href="<?cs var:toroot ?>training/location/receive-location-updates.html"> - Receiving Location Updates - </a> - </li> - <li> - <a href="<?cs var:toroot ?>training/location/display-address.html"> - Displaying a Location Address - </a> - </li> - <li><a href="<?cs var:toroot ?>training/location/geofencing.html"> - Creating and Monitoring Geofences - </a> - </li> - </ul> + <a href="<?cs var:toroot ?>training/sign-in/index.html" + description="How to add user sign-in functionality to your app."> + Adding Sign-In + </a> </li> </ul> </li> - <!-- End privacy and location --> + <!-- End user info and sign-in --> <li class="nav-section"> @@ -1805,19 +1828,18 @@ results." >Updating Your Security Provider to Protect Against SSL Exploits</a> </li> - <li class="nav-section"> - <div class="nav-section-header"> - <a href="<?cs var:toroot ?>training/enterprise/index.html" - description= - "How to implement device management policies for enterprise-oriented apps." - >Developing for Enterprise</a> - </div> - <ul> - <li><a href="<?cs var:toroot ?>training/enterprise/device-management-policy.html"> - Enhancing Security with Device Management Policies - </a> - </li> - </ul> + <li> + <a href="<?cs var:toroot ?>training/safetynet/index.html" + description= + "How to use the SafetyNet service to analyze a device where your app is running + and get information about its compatibility with your app." + >Checking Device Compatibility with SafetyNet</a> + </li> + + <li> + <a href="<?cs var:toroot ?>training/enterprise/device-management-policy.html" + description="How to create an application that enforces security policies on devices." + >Enhancing Security with Device Management Policies</a> </li> </ul> </li> @@ -1959,21 +1981,6 @@ results." </li> </ul> </li> - <li class="nav-section"> - <div class="nav-section-header"> - <a href="<?cs var:toroot ?>training/monetization/index.html" - description= - "How to implement monetization strategies for your app without compromising - the user experience." - >Monetizing Your App</a> - </div> - <ul> - <li><a href="<?cs var:toroot ?>training/monetization/ads-and-ux.html"> - Advertising without Compromising User Experience - </a> - </li> - </ul> - </li> </ul> </li> <!-- End best Publishing --> diff --git a/docs/html/training/tv/start/start.jd b/docs/html/training/tv/start/start.jd index 0f5871f..e55e202 100644 --- a/docs/html/training/tv/start/start.jd +++ b/docs/html/training/tv/start/start.jd @@ -1,4 +1,4 @@ -page.title=Getting Started with TV Apps +page.title=Get Started with TV Apps page.tags="leanback","recyclerview","launcher" trainingnavtop=true |