오류 처리
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android Auto와 Android Automotive (AAOS)는 재생 상태를 STATE_ERROR
로 설정하고 사용자에게 표시되는 현지화된 오류 메시지를 제공합니다. 그러면 앱이 사용자에게 메시지를 표시할 수 있습니다.
오류를 해결하려면 setErrorMessage
와 함께 오류 메시지를 제공합니다.
오류의 성격을 나타내는 오류 메시지를 설계할 때 사용할 수 있는 오류 코드 목록은 PlaybackStateCompat
를 참고하세요. 문제를 해결하기 위해 사용자가 휴대전화와 상호작용해야 하는 경우 오류 메시지에 이 안내를 포함하세요.
오류 메시지는 사용자에게 표시되는 것이므로 사용자의 언어에 맞게 타겟팅해야 합니다. 예를 들어 사용자의 언어로 된 콘텐츠를 사용할 수 없는 경우 ERROR_CODE_NOT_AVAILABLE_IN_REGION
을 사용합니다.
Kotlin
mediaSession.setPlaybackState(
PlaybackStateCompat.Builder()
.setState(PlaybackStateCompat.STATE_ERROR)
.setErrorMessage(PlaybackStateCompat.ERROR_CODE_NOT_AVAILABLE_IN_REGION, getString(R.string.error_unsupported_region))
// ...and any other setters.
.build())
자바
mediaSession.setPlaybackState(
new PlaybackStateCompat.Builder()
.setState(PlaybackStateCompat.STATE_ERROR)
.setErrorMessage(PlaybackStateCompat.ERROR_CODE_NOT_AVAILABLE_IN_REGION, getString(R.string.error_unsupported_region))
// ...and any other setters.
.build())
오류 상태에 관한 자세한 내용은 미디어 세션 사용: 상태 및 오류를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-22(UTC)
[null,null,["최종 업데이트: 2025-08-22(UTC)"],[],[],null,["# Handle errors\n\nAndroid Auto and Android Automotive (AAOS) set the playback state to\n`STATE_ERROR` and provide a user-facing, localized error message. The apps can\nthen display the message to the user.\n\nTo address an error, you provide an error message with [`setErrorMessage`](/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setErrorMessage(int,%20java.lang.CharSequence)).\n\nSee [`PlaybackStateCompat`](/reference/android/support/v4/media/session/PlaybackStateCompat) for a list of the error codes you can use when\ndesigning the error message to indicate the nature of the error. If a user\nmust interact with their phone to resolve an issue, include this instruction\nin the error message.\n\nError messages must be user-facing and targeted to the user's locale. For\nexample, if content is not available in the user's locale, use\n[`ERROR_CODE_NOT_AVAILABLE_IN_REGION`](/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_NOT_AVAILABLE_IN_REGION()). \n\n### Kotlin\n\n mediaSession.setPlaybackState(\n PlaybackStateCompat.Builder()\n .setState(PlaybackStateCompat.STATE_ERROR)\n .setErrorMessage(PlaybackStateCompat.ERROR_CODE_NOT_AVAILABLE_IN_REGION, getString(R.string.error_unsupported_region))\n // ...and any other setters.\n .build())\n\n### Java\n\n mediaSession.setPlaybackState(\n new PlaybackStateCompat.Builder()\n .setState(PlaybackStateCompat.STATE_ERROR)\n .setErrorMessage(PlaybackStateCompat.ERROR_CODE_NOT_AVAILABLE_IN_REGION, getString(R.string.error_unsupported_region))\n // ...and any other setters.\n .build())\n\nTo learn more about error states, see\n[Using a media session: States and errors](/guide/topics/media-apps/working-with-a-media-session#errors)."]]