From 61fcad92ab55e3f874eb8fddde39dbe64235c2e5 Mon Sep 17 00:00:00 2001 From: Ricardo Cervera Date: Fri, 10 Oct 2014 13:37:16 -0700 Subject: docs: Add SearchXonY to Common Intents Change-Id: Idb68c0dc95dfd0a21a73df707a7a1f5b21c3ee5e --- docs/html/guide/components/intents-common.jd | 319 +++++++++++++++++++-------- 1 file changed, 221 insertions(+), 98 deletions(-) diff --git a/docs/html/guide/components/intents-common.jd b/docs/html/guide/components/intents-common.jd index ac61924..d4b033a 100644 --- a/docs/html/guide/components/intents-common.jd +++ b/docs/html/guide/components/intents-common.jd @@ -80,6 +80,13 @@ page.tags="IntentFilter"
  • Initiate a phone call
  • + +
  • Search +
      +
    1. Search in a specific app
    2. +
    3. Perform a web search
    4. +
    +
  • Settings
    1. Open a specific section of Settings
    2. @@ -93,7 +100,6 @@ page.tags="IntentFilter"
    3. Web Browser
      1. Load a web URL
      2. -
      3. Perform a web search
    4. Verify Intents with the Android Debug Bridge
    5. @@ -205,7 +211,8 @@ on this page in response to voice commands. For more information, see

      Google Now

      @@ -302,7 +309,8 @@ android.provider.AlarmClock#ACTION_SET_ALARM} intent, your app must have the

      Google Now

      @@ -605,7 +613,8 @@ in an extra named "data".

      Google Now

      @@ -660,7 +669,8 @@ public void capturePhoto() {

      Google Now

      @@ -1351,7 +1361,8 @@ Framework guide.

      Google Now

      @@ -1362,14 +1373,21 @@ Framework guide.

      -

      To track a bike ride, use the "vnd.google.fitness.TRACK" action with the -"vnd.google.fitness.activity/biking" MIME type and set the "actionStatus" -extra to "ActiveActionStatus" when starting and to "CompletedActionStatus" -when stopping.

      +

      To track a bike ride, use the + +ACTION_TRACK action with the "vnd.google.fitness.activity/biking" +MIME type and set the + +EXTRA_STATUS extra to + +STATUS_ACTIVE when starting and to + +STATUS_COMPLETED when stopping.

      Action
      -
      "vnd.google.fitness.TRACK"
      +
      + ACTION_TRACK
      Data URI
      None
      @@ -1380,9 +1398,12 @@ when stopping.

      Extras
      -
      "actionStatus"
      -
      A string with the value "ActiveActionStatus" when starting and - "CompletedActionStatus" when stopping.
      +
      + EXTRA_STATUS
      +
      A string with the value + STATUS_ACTIVE when starting and + + STATUS_COMPLETED when stopping.
      @@ -1391,9 +1412,9 @@ when stopping.

      Example intent:

       public void startBikeRide() {
      -    Intent intent = new Intent("vnd.google.fitness.TRACK")
      +    Intent intent = new Intent(FitnessIntents.ACTION_TRACK)
                   .setType("vnd.google.fitness.activity/biking")
      -            .putExtra("actionStatus", "ActiveActionStatus");
      +            .putExtra(FitnessIntents.EXTRA_STATUS, FitnessIntents.STATUS_ACTIVE);
           if (intent.resolveActivity(getPackageManager()) != null) {
               startActivity(intent);
           }
      @@ -1422,7 +1443,8 @@ public void startBikeRide() {
       

      Google Now

      @@ -1433,14 +1455,21 @@ public void startBikeRide() {
      -

      To track a run, use the "vnd.google.fitness.TRACK" action with the -"vnd.google.fitness.activity/running" MIME type and set the "actionStatus" -extra to "ActiveActionStatus" when starting and to "CompletedActionStatus" -when stopping.

      +

      To track a run, use the + +ACTION_TRACK action with the "vnd.google.fitness.activity/running" +MIME type and set the + +EXTRA_STATUS extra to + +STATUS_ACTIVE when starting and to + +STATUS_COMPLETED when stopping.

      Action
      -
      "vnd.google.fitness.TRACK"
      +
      + ACTION_TRACK
      Data URI
      None
      @@ -1451,9 +1480,12 @@ when stopping.

      Extras
      -
      "actionStatus"
      -
      A string with the value "ActiveActionStatus" when starting and - "CompletedActionStatus" when stopping.
      +
      + EXTRA_STATUS
      +
      A string with the value + STATUS_ACTIVE when starting and + + STATUS_COMPLETED when stopping.
      @@ -1462,9 +1494,9 @@ when stopping.

      Example intent:

       public void startRun() {
      -    Intent intent = new Intent("vnd.google.fitness.TRACK")
      +    Intent intent = new Intent(FitnessIntents.ACTION_TRACK)
                   .setType("vnd.google.fitness.activity/running")
      -            .putExtra("actionStatus", "ActiveActionStatus");
      +            .putExtra(FitnessIntents.EXTRA_STATUS, FitnessIntents.STATUS_ACTIVE);
           if (intent.resolveActivity(getPackageManager()) != null) {
               startActivity(intent);
           }
      @@ -1492,7 +1524,8 @@ public void startRun() {
       

      Google Now

      @@ -1503,14 +1536,21 @@ public void startRun() {
      -

      To track a workout, use the "vnd.google.fitness.TRACK" action with the -"vnd.google.fitness.activity/other" MIME type and set the "actionStatus" -extra to "ActiveActionStatus" when starting and to "CompletedActionStatus" -when stopping.

      +

      To track a workout, use the + +ACTION_TRACK action with the "vnd.google.fitness.activity/other" +MIME type and set the + +EXTRA_STATUS extra to + +STATUS_ACTIVE when starting and to + +STATUS_COMPLETED when stopping.

      Action
      -
      "vnd.google.fitness.TRACK"
      +
      + ACTION_TRACK
      Data URI
      None
      @@ -1521,9 +1561,12 @@ when stopping.

      Extras
      -
      "actionStatus"
      -
      A string with the value "ActiveActionStatus" when starting and - "CompletedActionStatus" when stopping.
      +
      + EXTRA_STATUS
      +
      A string with the value + STATUS_ACTIVE when starting and + + STATUS_COMPLETED when stopping.
      @@ -1532,9 +1575,9 @@ when stopping.

      Example intent:

       public void startWorkout() {
      -    Intent intent = new Intent("vnd.google.fitness.TRACK")
      +    Intent intent = new Intent(FitnessIntents.ACTION_TRACK)
                   .setType("vnd.google.fitness.activity/other")
      -            .putExtra("actionStatus", "ActiveActionStatus");
      +            .putExtra(FitnessIntents.EXTRA_STATUS, FitnessIntents.STATUS_ACTIVE);
           if (intent.resolveActivity(getPackageManager()) != null) {
               startActivity(intent);
           }
      @@ -1562,7 +1605,8 @@ public void startWorkout() {
       

      Google Now

      @@ -1572,12 +1616,15 @@ public void startWorkout() {
      -

      To show the user's heart rate, use the "vnd.google.fitness.VIEW" action with the -"vnd.google.fitness.data_type
      /com.google.heart_rate.bpm"
      MIME type.

      +

      To show the user's heart rate, use the + +ACTION_VIEW action with the +"vnd.google.fitness.data_type/com.google.heart_rate.bpm" MIME type.

      Action
      -
      "vnd.google.fitness.VIEW"
      +
      + ACTION_VIEW
      Data URI
      None
      @@ -1592,8 +1639,8 @@ public void startWorkout() {

      Example intent:

      -public void showHR() {
      -    Intent intent = new Intent("vnd.google.fitness.VIEW")
      +public void showHeartRate() {
      +    Intent intent = new Intent(FitnessIntents.ACTION_VIEW)
                   .setType("vnd.google.fitness.data_type/com.google.heart_rate.bpm");
           if (intent.resolveActivity(getPackageManager()) != null) {
               startActivity(intent);
      @@ -1623,7 +1670,8 @@ public void showHR() {
       

      Google Now

      @@ -1633,12 +1681,16 @@ public void showHR() {
      -

      To show the user's step count, use the "vnd.google.fitness.VIEW" action with the -"vnd.google.fitness.data_type
      /com.google.step_count.cumulative"
      MIME type.

      +

      To show the user's step count, use the + +ACTION_VIEW action with the +"vnd.google.fitness.data_type
      /com.google.step_count
      .cumulative"
      MIME +type.

      Action
      -
      "vnd.google.fitness.VIEW"
      +
      + ACTION_VIEW
      Data URI
      None
      @@ -1654,7 +1706,7 @@ public void showHR() {

      Example intent:

       public void showStepCount() {
      -    Intent intent = new Intent("vnd.google.fitness.VIEW")
      +    Intent intent = new Intent(FitnessIntents.ACTION_VIEW)
                   .setType("vnd.google.fitness.data_type/com.google.step_count.cumulative");
           if (intent.resolveActivity(getPackageManager()) != null) {
               startActivity(intent);
      @@ -1689,7 +1741,8 @@ public void showStepCount() {
       

      Google Now

      @@ -1888,7 +1941,8 @@ public void playMedia(Uri file) {

      Google Now

      @@ -2134,7 +2188,8 @@ but the user must press the Call button to begin the phone call.

      Google Now

      @@ -2211,6 +2266,98 @@ public void dialPhoneNumber(String phoneNumber) { + + +

      Search using a specific app

      + + +
      +
      + + +
      +

      Google Now

      +
        +
      • "search for cat videos on myvideoapp"
      • +
      +
      + +

      To support search within the context of your app, declare an intent filter in your app with +the SEARCH_ACTION action, as shown in the example intent filter below.

      + +
      +
      Action
      +
      +
      +
      "com.google.android.gms.actions.SEARCH_ACTION"
      +
      Support search queries from Google Now.
      +
      +
      + +
      Extras
      +
      +
      +
      {@link android.app.SearchManager#QUERY}
      +
      A string that contains the search query.
      +
      +
      +
      + +

      Example intent filter:

      +
      +<activity android:name=".SearchActivity">
      +    <intent-filter>
      +        <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
      +        <category android:name="android.intent.category.DEFAULT"/>
      +    </intent-filter>
      +</activity>
      +
      + + + +

      Perform a web search

      + +

      To initiate a web search, use the {@link android.content.Intent#ACTION_WEB_SEARCH} action +and specify the search string in the +{@link android.app.SearchManager#QUERY SearchManager.QUERY} extra.

      + + +
      +
      Action
      +
      {@link android.content.Intent#ACTION_WEB_SEARCH}
      + +
      Data URI Scheme
      +
      None
      + +
      MIME Type
      +
      None
      + +
      Extras
      +
      +
      +
      {@link android.app.SearchManager#QUERY SearchManager.QUERY}
      +
      The search string.
      +
      +
      +
      + +

      Example intent:

      +
      +public void searchWeb(String query) {
      +    Intent intent = new Intent(Intent.ACTION_SEARCH);
      +    intent.putExtra(SearchManager.QUERY, query);
      +    if (intent.resolveActivity(getPackageManager()) != null) {
      +        startActivity(intent);
      +    }
      +}
      +
      + + + + + +

      Settings

      @@ -2379,7 +2526,8 @@ at {@link android.provider.Telephony}.

      Google Now

      @@ -2447,46 +2595,6 @@ open your Android app instead of your web page.

      -

      Perform a web search

      - -

      To initiate a web search, use the {@link android.content.Intent#ACTION_WEB_SEARCH} action -and specify the search string in the -{@link android.app.SearchManager#QUERY SearchManager.QUERY} extra.

      - - -
      -
      Action
      -
      {@link android.content.Intent#ACTION_WEB_SEARCH}
      - -
      Data URI Scheme
      -
      None
      - -
      MIME Type
      -
      None
      - -
      Extras
      -
      -
      -
      {@link android.app.SearchManager#QUERY SearchManager.QUERY}
      -
      The search string.
      -
      -
      -
      - -

      Example intent:

      -
      -public void searchWeb(String query) {
      -    Intent intent = new Intent(Intent.ACTION_SEARCH);
      -    intent.putExtra(SearchManager.QUERY, query);
      -    if (intent.resolveActivity(getPackageManager()) != null) {
      -        startActivity(intent);
      -    }
      -}
      -
      - - - - @@ -2588,7 +2696,8 @@ about declaring each intent filter, click on the action description.

    6. "stop cycling"
    7. - "vnd.google.fitness.TRACK" + + FitnessIntents.ACTION_TRACK @@ -2599,7 +2708,8 @@ about declaring each intent filter, click on the action description.

    8. "stop running"
    9. - "vnd.google.fitness.TRACK" + + FitnessIntents.ACTION_TRACK @@ -2610,7 +2720,8 @@ about declaring each intent filter, click on the action description.

    10. "stop workout"
    11. - "vnd.google.fitness.TRACK" + + FitnessIntents.ACTION_TRACK @@ -2620,7 +2731,8 @@ about declaring each intent filter, click on the action description.

    12. "what's my bpm"
    13. - "vnd.google.fitness.VIEW" + + FitnessIntents.ACTION_VIEW @@ -2630,7 +2742,8 @@ about declaring each intent filter, click on the action description.

    14. "what's my step count"
    15. - "vnd.google.fitness.VIEW" + + FitnessIntents.ACTION_VIEW Local @@ -2673,6 +2786,16 @@ about declaring each intent filter, click on the action description.

      {@link android.provider.MediaStore#INTENT_ACTION_VIDEO_CAMERA MediaStore
      .INTENT_ACTION_VIDEO_CAMERA} + Search + +

      Search using a specific app

      +
        +
      • "search for cat videos
        on myvideoapp"
      • +
      + + "com.google.android.gms.actions
      .SEARCH_ACTION"
      + + Web browser

      Open URL

      -- cgit v1.1