소리내어 읽기는 Android 기기에서 사용할 수 있는 Google 어시스턴트 기능으로, 사용자가 뉴스 기사나 블로그 게시물과 같은 긴 형식의 웹 콘텐츠를 읽을 수 있는 또 다른 방법을 제공합니다. 사용자가 "Hey Google, 소리내어 읽어 줘"라고 말하면 앱이 웹 기반 콘텐츠를 소리 내어 읽고 읽는 단어를 강조표시하며 페이지를 자동으로 스크롤하도록 할 수 있습니다. 이 기능에 관한 자세한 내용은 소리내어 읽기 제품 업데이트 게시물을 참고하세요.
overridefunonProvideAssistContent(outContent:AssistContent){super.onProvideAssistContent(outContent)// Set the web URI for content to be read from a// WebView, Chrome Custom Tab, or other sourcevalurlString=url.toString()outContent.setWebUri(Uri.parse(urlString))// Create JSON-LD object based on schema.org structured datavalstructuredData=JSONObject().put("@type","Article").put("name","ExampleName of blog post").put("url",outContent.getWebUri()).toString()outContent.setStructuredData(structuredData)}
Java
@OverridepublicvoidonProvideAssistContent(AssistContentoutContent){// Set the web URI for content to be read from a// WebView, Chrome Custom Tab, or other sourceStringurlString=url.toString();outContent.setWebUri(Uri.parse(urlString));try{// Create JSON-LD object based on schema.org structured dataStringstructuredData=newJSONObject().put("@type","Article").put("name","ExampleName of blog post").put("url",outContent.getWebUri()).toString();outContent.setStructuredData(structuredData);}catch(JSONExceptionex){// Handle exceptionLog.e(TAG,ex.getMessage());}super.onProvideAssistContent(outContent);}
onProvideAssistContent()를 구현할 때는 각 entity에 관해 최대한 많은 데이터를 제공하세요. 다음 필드는 필수입니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-08(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-08(UTC)"],[],[],null,["# Read It is a Google Assistant feature available on Android devices that offers\nanother way for users to read long-form web content like news articles and\nblog posts. Users can say something like *\"Hey Google, read it\"* to have an app\nread web-based content out loud, highlight the words being read, and auto-scroll\nthe page. To learn more about this feature, you can also read the\n[Read It product update post](https://www.blog.google/products/assistant/easier-access-web-pages-let-assistant-read-it-aloud/).\n**Figure 1.** Listening to an app read web content out loud.\n\nAndroid apps with web-based content can support Read It by providing information\nto Assistant using the [`onProvideAssistContent()`](/reference/android/app/Activity#onProvideAssistContent(android.app.assist.AssistContent)) method.\n\nThis process helps maintain the structure of data as it's shared with\nAssistant. Users who receive shared app content can then be deep linked or\nreceive content directly, instead of as text or a screenshot.\n\nImplement `onProvideAssistContent()` for any web-based content\nand any sharable [`entity`](/guide/app-actions/legacy/action-schema#entity) in your app.\n\nProvide content to Assistant\n----------------------------\n\nFor Read It to access your content, your app must provide Assistant with\ninformation about the content, like its web URI and some basic context.\nAssistant can then retrieve your content to be read out loud to the user.\n\nFor\nAndroid apps that already implement [web-based content](/guide/webapps) using WebViews or\nChrome Custom Tabs, use the same web URIs for Read It as a\nstarting point.\n\nWhen combining Read It functionality with built-in intents, you only need to\nimplement `onProvideAssistContent()` for the final app activity in the user's\ntask flow after invoking the App Action.\n\nFor example, if your app displays\nnews articles, implement `onProvideAssistContent()` in the final screen\nshowing the article; you don't need to implement it for any in-progress or\npreview screens.\n\nProvide a web URI for your content in the `uri` field of [`AssistContent`](/reference/android/app/assist/AssistContent).\nProvide contextual information as a [JSON-LD](//json-ld.org/) object\n[using schema.org vocabulary](https://schema.org/docs/documents.html) in the\n`structuredData` field.\n| **Note:** Read It functionality is not available for content that requires authentication, such as articles locked for users without a subscription.\n\nThe following code snippet shows an example of providing content to Assistant: \n\n### Kotlin\n\n```kotlin\noverride fun onProvideAssistContent(outContent: AssistContent) {\n super.onProvideAssistContent(outContent)\n\n // Set the web URI for content to be read from a\n // WebView, Chrome Custom Tab, or other source\n val urlString = url.toString()\n outContent.setWebUri(Uri.parse(urlString))\n\n // Create JSON-LD object based on schema.org structured data\n val structuredData = JSONObject()\n .put(\"@type\", \"Article\")\n .put(\"name\", \"ExampleName of blog post\")\n .put(\"url\", outContent.getWebUri())\n .toString()\n outContent.setStructuredData(structuredData)\n}\n```\n\n### Java\n\n```java\n@Override\npublic void onProvideAssistContent(AssistContent outContent) {\n\n // Set the web URI for content to be read from a\n // WebView, Chrome Custom Tab, or other source\n String urlString = url.toString();\n outContent.setWebUri(Uri.parse(urlString));\n\n try {\n // Create JSON-LD object based on schema.org structured data\n String structuredData = new JSONObject()\n .put(\"@type\", \"Article\")\n .put(\"name\", \"ExampleName of blog post\")\n .put(\"url\", outContent.getWebUri())\n .toString();\n outContent.setStructuredData(structuredData);\n } catch (JSONException ex) {\n // Handle exception\n Log.e(TAG, ex.getMessage());\n }\n\n super.onProvideAssistContent(outContent);\n}\n```\n\nWhen implementing `onProvideAssistContent()`, provide as much\ndata as possible about each `entity`. The following\nfields are required:\n\n- `@type`\n- `.name`\n- `.url` (only required if the content is URL-addressable)\n\nTo learn more about using [`onProvideAssistContent()`](/reference/android/app/Activity#onProvideAssistContent(android.app.assist.AssistContent)), see the\n[Optimizing Contextual Content for the Assistant](/training/articles/assistant) guide in\nthe Android developer documentation."]]