- 문법:
<receiver android:directBootAware=["true" | "false"] android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon="drawable resource" android:label="string resource" android:name="string" android:permission="string" android:process="string" > ... </receiver>
- 포함된 위치:
<application>
- 포함 가능한 요소:
<intent-filter>
<meta-data>
- 설명:
- broadcast receiver(
BroadcastReceiver
서브클래스)를 애플리케이션의 구성요소 중 하나로 선언합니다. broadcast receiver를 사용하면 애플리케이션의 다른 구성요소가 실행되고 있지 않을 때도 시스템이나 다른 애플리케이션에서 브로드캐스트하는 인텐트를 애플리케이션에서 수신할 수 있습니다.broadcast receiver를 시스템에 알리는 방법에는 두 가지가 있습니다. 한 가지 방법은 이 요소를 사용해 매니페스트 파일에 broadcast receiver를 선언하는 것입니다. 또 다른 방법은 코드에서 동적으로 broadcast receiver를 만든 다음
Context.registerReceiver()
메서드 또는 오버로드된 버전 중 하나를 사용해 등록하는 것입니다.broadcast receiver를 동적으로 만드는 방법에 관한 자세한 내용은
BroadcastReceiver
클래스 설명을 참고하세요.이 broadcast receiver가 시스템 이외의 브로드캐스트를 처리하는 경우
android:exported
값을 지정합니다. broadcast receiver가 다른 애플리케이션에서 브로드캐스트를 수신할 수 있게 하려면 이 값을"true"
로 설정하고 broadcast receiver가 내 앱의 브로드캐스트만 수신할 수 있게 하려면"false"
로 설정합니다.android:permission
속성을 이미 선언했다면 삭제하지 않아도 됩니다.경고: 앱에 설정하는 broadcast receiver 수를 제한합니다. broadcast receiver가 너무 많으면 앱 성능과 사용자 기기의 배터리 수명에 영향을 줄 수 있습니다. 백그라운드 작업 예약에
BroadcastReceiver
클래스 대신 사용할 수 있는 API에 관한 자세한 내용은 백그라운드 최적화를 참고하세요. - 속성:
android:directBootAware
broadcast receiver가 직접 부팅을 인식하는지 여부입니다. 즉, 사용자가 기기를 잠금 해제하기 전에 기기가 실행될 수 있는지 여부를 지정합니다.
참고: 직접 부팅되는 동안 애플리케이션의 broadcast receiver는 기기 보호 저장소에 저장된 데이터에만 액세스할 수 있습니다.
기본값은
"false"
입니다.android:enabled
- 시스템에서 broadcast receiver를 인스턴스화할 수 있는지 여부입니다. 인스턴스화할 수 있으면
"true"
이고 인스턴스화할 수 없으면"false"
입니다. 기본값은"true"
입니다.<application>
요소에는 broadcast receiver를 비롯하여 모든 애플리케이션 구성요소에 적용되는 자체enabled
속성이 있습니다. broadcast receiver를 사용하려면<application>
및<receiver>
속성이 모두"true"
여야 합니다. 둘 중 하나가"false"
면 broadcast receiver가 사용 중지되며 인스턴스화될 수 없습니다. android:exported
- broadcast receiver에서 애플리케이션 외부의 비시스템 소스에서 메시지를 수신할 수 있는지 여부입니다. 할 수 있으면
"true"
이고 할 수 없으면"false"
입니다."false"
인 경우 broadcast receiver는 시스템이나 동일한 애플리케이션의 구성요소, 사용자 ID가 같은 애플리케이션에서 보낸 메시지만 수신할 수 있습니다.지정하지 않으면 기본값은 broadcast receiver에 인텐트 필터가 포함되어 있는지에 따라 달라집니다. broadcast receiver에 인텐트 필터가 1개 이상 포함되어 있으면 기본값은
"true"
이고 그 외 경우 기본값은"false"
입니다.이 속성이 broadcast receiver의 외부 노출을 제한하는 유일한 방법은 아닙니다. 권한을 사용해 broadcast receiver에 메시지를 보낼 수 있는 외부 항목을 제한할 수도 있습니다.
permission
속성을 참고하세요. android:icon
- broadcast receiver를 나타내는 아이콘입니다. 이 속성은 이미지 정의가 포함된 드로어블 리소스의 참조로 설정됩니다.
이 속성이 설정되지 않은 경우 전체 애플리케이션에 지정된 아이콘이 대신 사용됩니다.
<application>
요소의icon
속성을 참고하세요.broadcast receiver의 아이콘은 여기에 설정되었는지 또는
<application>
요소에 의해 설정되었는지 여부와 상관없이 모든 receiver 인텐트 필터의 기본 아이콘이기도 합니다.<intent-filter>
요소의icon
속성을 참고하세요. android:label
- broadcast receiver에 관한 사용자가 읽을 수 있는 라벨입니다. 이 속성을 설정하지 않으면 애플리케이션 전체에 설정된 라벨이 대신 사용됩니다.
<application>
요소의label
속성을 참고하세요.broadcast receiver의 라벨은 여기에 설정되었는지 또는
<application>
요소에 의해 설정되었는지 여부와 상관없이 모든 broadcast receiver 인텐트 필터의 기본 라벨이기도 합니다.<intent-filter>
요소의label
속성을 참고하세요.라벨은 사용자 인터페이스의 다른 문자열처럼 현지화될 수 있도록 문자열 리소스의 참조로 설정합니다. 하지만 애플리케이션을 개발하는 동안 편의를 위해 라벨을 원시 문자열로 설정할 수도 있습니다.
android:name
- broadcast receiver를 구현하는 클래스의 이름으로,
BroadcastReceiver
의 서브클래스입니다. 이 이름은 정규화된 클래스 이름(예:"com.example.project.ReportReceiver"
)이어야 하지만 하지만 약식으로 이름의 첫 번째 문자가 마침표인 경우(예".ReportReceiver"
)<manifest>
요소에 지정된 패키지 이름에 추가됩니다.애플리케이션을 게시한 후에는
android:exported="false"
를 설정하지 않는 한 이 이름을 변경하지 마세요.기본값은 없으며, 이름을 지정해야 합니다.
android:permission
- broadcaster가 broadcast receiver에 메시지를 보내는 데 필요한 권한 이름입니다.
이 속성이 설정되어 있지 않으면
<application>
요소의permission
속성에서 설정한 권한이 broadcast receiver에 적용됩니다. 아무 속성도 설정되어 있지 않으면 broadcast receiver가 권한으로 보호되지 않습니다. android:process
- broadcast receiver가 실행되는 프로세스의 이름입니다.
일반적으로 애플리케이션의 모든 구성요소는 애플리케이션용으로 만들어진 기본 프로세스에서 실행됩니다. 애플리케이션 패키지와 이름이 동일합니다.
<application>
요소의process
속성은 모든 구성요소에 다른 기본값을 설정할 수 있습니다. 하지만 각 구성요소는 고유한process
속성을 사용해 이 기본값을 재정의할 수 있으므로, 이 방법을 통해 애플리케이션을 여러 프로세스에 확산시킬 수 있습니다.이 속성에 지정된 이름이 콜론(
:
)으로 시작되면 필요에 따라 애플리케이션 전용의 새 프로세스가 만들어지고, 이 프로세스에서 broadcast receiver가 실행됩니다.프로세스 이름이 소문자로 시작되는 경우 broadcast receiver는 그 이름의 전역 프로세스에서 실행됩니다(실행 권한이 있는 경우). 이를 통해 서로 다른 애플리케이션의 구성요소가 프로세스를 공유하여 리소스 사용을 줄일 수 있습니다.
- 도입 수준:
- API 수준 1
<수신자>
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(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-07-27(UTC)"],[],[],null,["# <receiver\u003e\n\nsyntax:\n:\n\n ```xml\n \u003creceiver android:directBootAware=[\"true\" | \"false\"]\n android:enabled=[\"true\" | \"false\"]\n android:exported=[\"true\" | \"false\"]\n android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\"\n android:permission=\"string\"\n android:process=\"string\" \u003e\n ...\n \u003c/receiver\u003e\n ```\n\ncontained in:\n: [\u003capplication\u003e](/guide/topics/manifest/application-element)\n\ncan contain:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n\n [\u003cmeta-data\u003e](/guide/topics/manifest/meta-data-element)\n\ndescription:\n: Declares a broadcast receiver, a [BroadcastReceiver](/reference/android/content/BroadcastReceiver)\n subclass, as one of the application's components. Broadcast receivers enable\n applications to receive intents that are broadcast by the system or by other\n applications, even when other components of the application aren't running.\n\n\n There are two ways to make a broadcast receiver known to the system. One is to\n declare it in the manifest file with this element. The other is to create\n the receiver dynamically in code and register it with the\n [Context.registerReceiver()](/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter))\n method or one of its overloaded versions.\n\n\n For more information about how to dynamically create receivers, see the\n [BroadcastReceiver](/reference/android/content/BroadcastReceiver) class\n description.\n\n\n If this receiver handles non-system broadcasts, specify a value for `android:exported`.\n Set this value to `\"true\"` if you want your receiver to be able to\n receiver broadcasts from other applications or `\"false\"` if you only\n want your receiver to be able to receive broadcasts from your own app.\n\n\n You don't have to remove the `android:permission` attribute if you\n already declared it.\n\n\n **Warning:** Limit how many broadcast\n receivers you set in your app. Having too many broadcast receivers can\n affect your app's performance and the battery life of users' devices.\n For more information about APIs you can use instead of the\n `BroadcastReceiver` class for scheduling background work, see\n [Background optimization](/topic/performance/background-optimization).\n\nattributes:\n:\n\n `android:directBootAware`\n\n : Whether the broadcast receiver is *Direct-Boot aware*, that\n is, whether it can run before the user unlocks the device.\n\n **Note:** During\n [Direct Boot](/training/articles/direct-boot), a broadcast\n receiver in your application can only access the data that is stored in\n *device protected* storage.\n\n The default value is `\"false\"`.\n\n `android:enabled`\n : Whether the broadcast receiver can be instantiated by the system. It's\n `\"true\"` if it can be, and `\"false\"` if not. The default value\n is `\"true\"`.\n\n\n The [\u003capplication\u003e](/guide/topics/manifest/application-element) element has its own\n [enabled](/guide/topics/manifest/application-element#enabled) attribute that applies to all\n application components, including broadcast receivers. The\n `\u003capplication\u003e` and\n `\u003creceiver\u003e` attributes must both be `\"true\"` for\n the broadcast receiver to be enabled. If either is `\"false\"`, it's\n disabled and can't be instantiated.\n\n `android:exported`\n : Whether the broadcast receiver can receive messages from non-system sources\n outside its application. It's `\"true\"` if it can, and `\"false\"`\n if not. If `\"false\"`, the only messages the broadcast receiver\n receives are those sent by the system, components of the same application, or applications\n with the same user ID.\n\n\n If unspecified, the default value depends on whether the broadcast receiver contains intent\n filters. If the receiver contains at least one intent filter, then the default value is\n `\"true\"`. Otherwise, the default value is `\"false\"`.\n\n\n This attribute is not the only way to limit a broadcast receiver's external exposure.\n You can also use a permission to limit the external entities that can send it messages.\n See the [permission](/guide/topics/manifest/receiver-element#prmsn) attribute.\n\n `android:icon`\n : An icon representing the broadcast receiver. This attribute is set\n as a reference to a drawable resource containing the image definition.\n If it isn't set, the icon specified for the application as a whole is used\n instead. See the [\u003capplication\u003e](/guide/topics/manifest/application-element)\n element's [icon](/guide/topics/manifest/application-element#icon) attribute.\n\n\n The broadcast receiver's icon, whether set here or by the\n `\u003capplication\u003e` element, is also the\n default icon for all the receiver's intent filters. See the\n [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element) element's\n [icon](/guide/topics/manifest/intent-filter-element#icon) attribute.\n\n `android:label`\n : A user-readable label for the broadcast receiver. If this attribute isn't\n set, the label set for the application as a whole is\n used instead. See the [\u003capplication\u003e](/guide/topics/manifest/application-element) element's\n [label](/guide/topics/manifest/application-element#label) attribute.\n\n\n The broadcast receiver's label, whether set here or by the\n `\u003capplication\u003e` element, is also the\n default label for all the receiver's intent filters. See the\n [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element) element's\n [label](/guide/topics/manifest/intent-filter-element#label) attribute.\n\n\n The label is set as a reference to a string resource, so that\n it can be localized like other strings in the user interface.\n However, as a convenience while you're developing the application,\n it can also be set as a raw string.\n\n `android:name`\n : The name of the class that implements the broadcast receiver, a subclass of\n [BroadcastReceiver](/reference/android/content/BroadcastReceiver). This is a fully qualified\n class name, such as `\"com.example.project.ReportReceiver\"`. However,\n as a shorthand, if the first character of the name is a period, for example,\n `\".ReportReceiver\"`, it is appended to the package name specified in\n the [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element) element.\n\n Once you publish your application, [don't\n change this name](http://android-developers.blogspot.com/2011/06/things-that-cannot-change.html), unless you set [android:exported](#exported)`=\"false\"`.\n\n\n There is no default. The name must be specified.\n\n `android:permission`\n : The name of a permission that broadcasters need in order to send a\n message to the broadcast receiver.\n If this attribute isn't set, the permission set by the\n [\u003capplication\u003e](/guide/topics/manifest/application-element) element's\n [permission](/guide/topics/manifest/application-element#prmsn) attribute applies\n to the broadcast receiver. If neither attribute is set, the receiver\n isn't protected by a permission.\n\n\n For more information about permissions, see the\n [Permissions](/guide/topics/manifest/manifest-intro#perms)\n section in the app manifest overview and\n [Security tips](/guide/topics/security/security).\n\n `android:process`\n\n : The name of the process in which the broadcast receiver runs. Normally, all components of an application run in the default process created for the application. It has the same name as the application package.\u003cbr /\u003e\n\n The\n [\u003capplication\u003e](/guide/topics/manifest/application-element) element's\n [process](/guide/topics/manifest/application-element#proc) attribute can set a different\n default for all components. But each component can override the default\n with its own `process` attribute, letting you spread your\n application across multiple processes.\n\n\n If the name assigned to this attribute begins with a colon (`:`), a new\n process, private to the application, is created when it's needed, and\n the broadcast receiver runs in that process.\n\n\n If the process name begins with a lowercase character, the receiver runs\n in a global process of that name, provided that it has permission to do so.\n This lets components in different applications share a process, reducing\n resource usage.\n\nintroduced in:\n: API level 1"]]