diff --git a/docs/html/images/tools/ai-appindexingtest.png b/docs/html/images/tools/ai-appindexingtest.png new file mode 100644 index 0000000000000..385bc21f12cc8 Binary files /dev/null and b/docs/html/images/tools/ai-appindexingtest.png differ diff --git a/docs/html/tools/help/app-link-indexing.jd b/docs/html/tools/help/app-link-indexing.jd index 611373a28ab5e..5b76059a52c18 100644 --- a/docs/html/tools/help/app-link-indexing.jd +++ b/docs/html/tools/help/app-link-indexing.jd @@ -1,4 +1,4 @@ -page.title=Deep Link and App Indexing API Support in Android Studio +page.title=Supporting URLs and App Indexing in Android Studio parent.title=Tools parent.link=index.html page.tags=app indexing @@ -9,11 +9,13 @@ page.tags=app indexing

In this document

  1. Typical Workflow
  2. -
  3. Adding an Intent Filter for Deep Linking and Google Search
  4. +
  5. Adding an Intent Filter for URL Support and Google Search
  6. Adding App Indexing API Skeleton Code to an Activity
  7. -
  8. Testing a Deep Link
  9. +
  10. Testing a URL
  11. Viewing App Indexing API Messages in the logcat Monitor
  12. Configuring Lint
  13. +
  14. Performing a Google App Indexing Test
  15. +

See also

@@ -48,15 +50,16 @@ page.tags=app indexing -

Android Studio helps you add deep links, app indexing, and search functionality to your apps. +

Android Studio helps you add support for URLs, app indexing, and search +functionality to your apps. These features can help to drive more traffic to your app, discover which app content is used most, make it easier for users to find content in an installed app, and attract new users.

Typical Workflow

-

To use Android Studio to add deep link, app indexing, and search features to your app, follow - these basic steps:

+

To use Android Studio to add support for URL, app indexing, and search +features to your app:

  1. Add intent filters and code to handle incoming intents.
  2. @@ -64,23 +67,25 @@ page.tags=app indexing
  3. Add App Indexing API code.
-

Intent filters and the App Indexing API are ways to implement deep links and app indexing, but +

Intent filters and the App Indexing API are ways to implement URL support +and app indexing, but there are other possible implementations as well. See Alternate Android Indexing Methods for more information.

-

Intent filters for deep links

+

Intent filters for URLs

Android Studio can create a basic intent filter in your manifest that you can customize to - define deep link URLs for your app. You can then write Java code in an activity to handle the + define URLs for your app. You can then write Java code in an activity to handle the intent. This implementation lets users directly open the specified app activity by - clicking a deep link. Users can see the deep links in google.com in a browser, in the + clicking a URL. Users can see the URLs in google.com in a browser, in the Google Search app, and in Google Now on Tap.

-

Website association with deep links

+

Website association with URLs

-

After setting up deep links for your app, you can associate your website with your app by using +

After setting up URL support for your app, you can associate your website +with your app by using the Google Search Console and Google Play Developer Console. Afterward, Google indexes your app for URLs defined in your intent filters and begins to include them in search results. In addition, you can optionally @@ -91,11 +96,11 @@ page.tags=app indexing

As an alternative to associating your app with a website, for Android 6.0 (API level 23) and higher, you can add default handlers and verification for deep links + >default handlers and verification for URLs instead.

-

Chrome displaying google.com serves search results with deep links that are accessible to both - signed-in users and those who aren't. Google Search app users must be signed in to see deep links +

Chrome displaying google.com serves search results with URLs that are accessible to both + signed-in users and those who aren't. Google Search app users must be signed in to see URLs in their search results.

App Indexing API code in activities

@@ -108,24 +113,27 @@ page.tags=app indexing class="external-link">Googlebot can’t get content from your app.

-

Deep link and App Indexing API testing

+

URL support and App Indexing API testing

Android Studio helps you test your code with the following features:

-

The details for implementing deep links and app indexing are described next. +

The details for implementing URL support and app indexing are described next. -

Adding an Intent Filter for Deep Linking and Google Search

+

Adding an Intent Filter for URL Support and Google Search

-

To use Android Studio features to add an intent filter defining a deep link, follow these - steps:

+

To use Android Studio features to add an intent filter defining a URL:

  1. In the Android view @@ -138,11 +146,11 @@ page.tags=app indexing style="vertical-align:sub;margin:0;height:17px" alt="Lightbulb icon" /> appears. Click Lightbulb icon - and select Create Deep Link.
  2. + and select Create URL.
  3. Right-click in an <activity> element and select Generate - > Deep Link.
  4. + > URL.
  5. Place your cursor in an activity, and then select Code > - Generate > Deep Link.
  6. + Generate > URL.

    The Code Editor adds skeleton code using the @@ -154,7 +162,7 @@ page.tags=app indexing

    The Code Editor adds an intent filter similar to the following:

     <!-- ATTENTION: This intent was auto-generated. Follow instructions at
    - https://g.co/AppIndexing/AndroidStudio to publish your Android app deep links. -->
    + https://g.co/AppIndexing/AndroidStudio to publish your URLs. -->
     <intent-filter>
        <action android:name="android.intent.action.VIEW" />
     
    @@ -177,19 +185,20 @@ page.tags=app indexing
     
     

    We recommend that you define a <data> element that supports URLs that you’ll add in the future. In the previous sample code, for example, Google will index any URLs starting - with www.example.com/gizmos. Also, remember to - include a deep link for your app home screen so it’s included in search results.

    + with http://www.example.com/gizmos. Also, remember to + include a URL for your app home screen so it’s included in search results.

    -

    Deep link URLs can be the same as the URLs of the comparable pages on your website.

    +

    The URLs you specify in your intent filters can be the same as the URLs of +the comparable pages on your website.

  7. In the corresponding activity, add Java code to read data from the intent filter and direct the app to respond accordingly.
  8. -
  9. Test your deep link.
  10. +
  11. Test your URL.
-

To support Google Search for your deep links, follow these steps:

+

To support Google Search for your URLs:

  1. Define an association @@ -198,7 +207,7 @@ page.tags=app indexing link default handling and verification.

  2. Optionally exclude app URLs + class="external-link">exclude certain URLs from the Google index.
  3. Optionally add App Indexing API code to support additional search features.
  4. @@ -207,27 +216,28 @@ page.tags=app indexing

    To test and debug your links, you can use the following Android Studio features:

    In addition, you can preview your APK in the Google Search Console - to test your deep links, whether the app is associated with a website or not.

    + to test your URLs, whether the app is associated with a website or not.

    Adding App Indexing API Skeleton Code to an Activity

    -

    After adding deep links, you can add App Indexing API code to an activity to support additional - search features.

    +

    After adding URL support to your app, you can add App Indexing API code to +an activity to support additional search features.

    -

    To add App Indexing API code to an activity, follow these steps:

    +

    To add App Indexing API code to an activity:

    1. In Android view in the Project window, double-click the activity Java file to open it in the @@ -297,9 +307,9 @@ page.tags=app indexing // this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. - Uri.parse("http://host/path"), - // TODO: Make sure this auto-generated app deep link URI is correct. - Uri.parse("android-app://com.example/http/host/path") + Uri.parse("http://www.example.com/gizmos"), + // TODO: Make sure this auto-generated app URL is correct. + Uri.parse("android-app://com.example/http/www.example.com/gizmos") ); AppIndex.AppIndexApi.start(client, viewAction); } @@ -317,9 +327,9 @@ page.tags=app indexing // this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. - Uri.parse("http://host/path"), - // TODO: Make sure this auto-generated app deep link URI is correct. - Uri.parse("android-app://com.example/http/host/path") + Uri.parse("http://www.example.com/gizmos"), + // TODO: Make sure this auto-generated app URL is correct. + Uri.parse("android-app://com.example/http/www.example.com/gizmos") ); AppIndex.AppIndexApi.end(client, viewAction); client.disconnect(); @@ -363,7 +373,9 @@ page.tags=app indexing

      In addition, you can @@ -371,12 +383,12 @@ page.tags=app indexing class="external-link">preview your APK in the Google Search Console.

      -

      Testing a Deep Link

      +

      Testing a URL

      -

      When you run your app from Android Studio, you can specify a deep link to launch so you can +

      When you run your app from Android Studio, you can specify a URL to launch so you can test it.

      -

      To launch a deep link from Android Studio, follow these steps:

      +

      To launch a URL from Android Studio:

      1. In Android Studio, open your project in Android view.
      2. @@ -385,14 +397,14 @@ page.tags=app indexing
      3. In the Run/Debug Configurations dialog, beneath Android Application, select the module you want to test.
      4. Select the General tab.
      5. -
      6. In the Launch field, select Deep Link.
      7. -
      8. In the Deep Link field, click to select from a list of - defined deep links.
      9. +
      10. In the Launch field, select URL.
      11. +
      12. In the URL field, click to select from a list of + defined URLs.
      13. Or type the URL you want to test, for example, http://example.com/gizmos.

      14. Click OK.
      15. Select Run > Run app or Debug app.
      16. -
      17. If the Device Chooser dialog appears, select a connected device or an +
      18. If the Select Deployment Target dialog appears, select a connected device or an emulator, and click OK.
      19. If the link is successful, the app launches in the device or emulator, and displays the app at @@ -411,12 +423,12 @@ page.tags=app indexing

        The logcat Monitor can display app indexing log messages to determine if your App Indexing API code is pushing the correct data to the cloud. For example, you can check the app title and the - URL. The logcat Monitor is part of Android Monitor in Android Studio.

        + URL. The logcat Monitor is part of Android Monitor in Android Studio.

        -

        Follow these steps:

        +

        To view App Indexing API messages in the logcat Monitor:

          -
        1. Run your app in Android Studio so it launches a deep link.
        2. -
        3. Display Android Monitor +
        4. Run your app in Android Studio so it launches a URL.
        5. +
        6. Display Android Monitor and click the logcat tab.
        7. Set the log level to Verbose.
        8. @@ -445,10 +457,10 @@ page.tags=app indexing

          Configuring Lint

          -

          You can use the Android Studio built-in Lint tool to check whether you have valid deep links +

          You can use the Android Studio built-in Lint tool to check whether you have valid URLs defined in the manifest and have implemented the App Indexing API correctly in activities.

          -

          You can view deep link and app indexing warnings and errors in two ways:

          +

          You can view URL and app indexing warnings and errors in two ways:

          • As pop-up text in the Code Editor. When Lint finds a problem, it highlights the problematic code in yellow, or underlines the code in red for more serious issues.
          • @@ -458,7 +470,7 @@ page.tags=app indexing -

            To set default Lint checks for deep links and the App Indexing API, follow these steps:

            +

            To set default Lint checks for URLs and the App Indexing API:

            1. In Android Studio, open your project in Android view. @@ -472,25 +484,24 @@ page.tags=app indexing respectively.
            2. Expand the Android Lint category and change the Lint settings as needed:
              • -
              • Missing Support for Google App Indexing - Reports a warning if the app hasn’t - implemented deep links, which are used by Google Search. This warning setting is enabled by +
              • Missing support for Google App Indexing - Reports a warning if the app hasn’t + implemented URLs, which are used by Google Search. This warning setting is enabled by default.
              • -
              • Missing Support for Google App Indexing API - Reports if an app hasn’t +
              • Missing support for Google App Indexing API - Reports if an app hasn’t implemented the App Indexing API at all. This warning setting is disabled by default.
              • -
              • Incorrect Usage of App Link for Google App Indexing - Reports deep link +
              • URL not supported by app for Google App Indexing - Reports URL errors in manifest code. This error setting is enabled by default.

              For example, the following Lint warning appears for the first setting:

              -

              +

              Lint warning

            3. Click OK.
            -

            To produce a list of Lint checks displayed in the Inspection Results window, - follow these steps:

            +

            To produce a list of Lint checks displayed in the Inspection Results window:

            1. In Android Studio, open your project in Android view @@ -504,7 +515,7 @@ page.tags=app indexing dialog, optionally click Manage to define a new profile, specify the Lint settings you want, and then click OK.
            2. In the Inspections dialog, you can search for the string "app indexing" -to find the deep link and App Indexing API Lint checks. Note that changing Lint settings for a +to find the URL and App Indexing API Lint checks. Note that changing Lint settings for a profile in the Inspections dialog doesn’t change the default settings, as described in the previous procedure. It does change the settings for profiles displayed in the Inspections dialog, however.

              @@ -512,3 +523,87 @@ the previous procedure. It does change the settings for profiles displayed in th

              The results appear in the Inspection Results window.

            + + +

            Performing a Google App Indexing Test

            + +

            You can use a Google App Indexing Test to check whether Google can index +a URL by either crawling your app page or using the App Indexing API. +Google can index the URL if your app supports at least one of the following: +

            +
              +
            • Googlebot can open and crawl the page identified by the URL.
            • +
            • Your app sends the correct data by using the App Indexing API.
            • +
            + +

            To perform a Google App Indexing Test:

            +
              +
            1. Add URL and +App Indexing API support to your app. +
            2. +
            3. While your project is open in Android Studio, select Tools +> Android > Google App Indexing Test. +
            4. +
            5. In the Google App Indexing Test dialog, select a +Module, URL, and Language. +
            6. +
            7. Log in if you see a message asking you to log into a Google Cloud Platform +account.
            8. +
            9. In the Google App Indexing Test dialog, click OK. +
            10. + +

              Android Studio builds the APK and starts the test. The test can take a few +minutes to complete. The results appear in a new tab in the Code Editor.

              +

              + +

              If the app preview on the right shows the screen that corresponds to the URL +you're testing, then Googlebot can find the URL.

              + +
            11. Correct any issues the test identifies, and repeat the test as often as +needed.
            12. + +
            + +

            The following table lists common errors and warnings you might encounter.

            + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            Warning or ErrorDescription
            Error: Google cannot index this page.Your app can't be crawled by Googlebot or using the App Indexing API, + so Google isn't able to index this app.
            Warning: The App URL you sent by using the App Indexing API doesn't + match the URL opened.When calling the App Indexing API, the URL specified in the app must + match the opened URL.
            Warning: Google cannot index this page using the App Indexing API + because the title is empty.When calling the App Indexing API, the title shouldn't be empty.
            Warning: Google can index this page using Googlebot crawling but + identified blocked resources.The app references other resources, and some of them are blocked or + temporarily unavailable. If these resources aren't critical, it might not + matter. Check the preview on the right to see whether the content + displays correctly. To fix this issue, make sure the resources aren't + blocked by robots.txt.
            Warning: Google cannot index this page using the App Indexing API.Your app isn’t using the App Indexing API. We recommended adding App + Indexing API support to your app.
            + diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index 9f575d41ed6fb..4e1d91a6e9f83 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -100,7 +100,7 @@
          • Improving Code Inspection with Annotations
          • - Deep Link and App Indexing API Support
          • + Supporting URLs and App Indexing in Android Studio
          diff --git a/docs/html/training/app-indexing/index.jd b/docs/html/training/app-indexing/index.jd index a1a47e96844f4..60f40b4a26960 100644 --- a/docs/html/training/app-indexing/index.jd +++ b/docs/html/training/app-indexing/index.jd @@ -22,7 +22,7 @@ startpage=true target="_blank">App Indexing for Google Search
        9. Intents and Intent Filters
        10. -
        11. Deep Link and App Indexing API Support in Android Studio
        12. +
        13. Supporting URLs and App Indexing in Android Studio
        14. diff --git a/docs/html/training/app-links/index.jd b/docs/html/training/app-links/index.jd index 27b6480287936..80309ee1a62df 100644 --- a/docs/html/training/app-links/index.jd +++ b/docs/html/training/app-links/index.jd @@ -16,7 +16,7 @@ page.tags=androidm,marshmallow

        See also

          -
        1. Deep Link and App Indexing API Support in Android Studio
        2. +
        3. Supporting URLs and App Indexing in Android Studio