From 37613a19c759fcfcd5bc03fdf46d21915ea317ad Mon Sep 17 00:00:00 2001 From: David Friedman Date: Wed, 7 Oct 2015 18:27:25 -0700 Subject: [PATCH] Docs: Adds an intent to the list. DAC counterpart to Critique CL 104821986. Bug: 22197200 Change-Id: I7beddc2788ddbaeb98d963167c0f081e619faee3 --- docs/html/guide/components/intents-common.jd | 71 ++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/docs/html/guide/components/intents-common.jd b/docs/html/guide/components/intents-common.jd index 91d57c4bb2b7c..621222bec6f6d 100644 --- a/docs/html/guide/components/intents-common.jd +++ b/docs/html/guide/components/intents-common.jd @@ -66,6 +66,11 @@ page.tags="IntentFilter"
  • Play music based on a search query
  • +
  • New Note +
      +
    1. Create a note
    2. +
    +
  • Phone
    1. Initiate a phone call
    2. @@ -1780,6 +1785,72 @@ protected void onCreate(Bundle savedInstanceState) { +

      New Note

      + +

      Create a note

      + +

      To create a new note, use the + +{@code ACTION_CREATE_NOTE} action and specify note details such as the subject and text using extras defined below.

      + +

      Note: Apps must ask for confirmation from the user +before completing the action.

      + +
      +
      Action
      +
      + {@code ACTION_CREATE_NOTE} +
      + +
      Data URI Scheme
      +
      None
      + +
      MIME Type
      +
      +{@code PLAIN_TEXT_TYPE}
      +
      "*/*"
      + + +
      Extras
      +
      +
      +
      + {@code EXTRA_NAME} +
      A string indicating the title or subject of the note.
      +
      + {@code EXTRA_TEXT} +
      A string indicating the text of the note.
      +
      +
      + + +

      Example intent:

      +
      +public void createNote(String subject, String text) {
      +    Intent intent = new Intent(NoteIntents.ACTION_CREATE_NOTE)
      +            .putExtra(NoteIntents.EXTRA_NAME, subject)
      +            .putExtra(NoteIntents.EXTRA_TEXT, text);
      +    if (intent.resolveActivity(getPackageManager()) != null) {
      +        startActivity(intent);
      +    }
      +}
      + + +

      Example intent filter:

      +
      +<activity ...>
      +    <intent-filter>
      +        <action android:name="com.google.android.gms.actions.CREATE_NOTE" />
      +        <category android:name="android.intent.category.DEFAULT" />
      +        <data android:mimeType=”*/*”>
      +    </intent-filter>
      +</activity>
      +
      + + + + +

      Phone