일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- flutter bloc
- valorant api dart
- flutter widget
- lol api dart
- dart new
- dart new 키워드
- flutter ios 폴더
- com.google.GIDSignIn
- flutter android 폴더
- swift concurrency
- PlatformException(sign_in_failed
- dart.dev
- keychain error
- riot api dart
- 파이썬
- tft api dart
- widget
- docker overview
- generate parentheses dart
- AnimationController
- swift 동시성
- dart
- 롤토체스 api dart
- leetcode dart
- flutter statefulwidget
- Architectural overview
- 파이썬 부동소수점
- 롤 api dart
- flutter
- 발로란트 api dart
- Today
- Total
aspe
Android - Intent 본문
Flutter native notification을 구현하던 도중, notifiaction을 클릭하면 앱을 실행시키고 싶었습니다. 그런 동작을 위해서는 Intent에 대한 이해가 필요했습니다. 알아보도록 합시다.
Intent
Intent란 실행될 오퍼레이션에 대한 추상적인 묘사를 의미합니다. android.app.Activity 를 런치하기 위해 startActivity와 사용 될 수도 있고, BroadcastReceiver 컴포넌트에 인텐트를 전송하기 위해 broadcastIntent와 함께 사용 될 수도 있고, 백그라운드 android.app.Service와 동작하기 위해 android.content.Context#startService or android.content.Context#bindService와 함께 사용 할 수도 있습니다.
Intent는 서로 다른 어플리케이션의 코드 사이에 late runtime binding을 수행하는 기능 또한 제공합니다. Intent의 가장 자주 사용되는 용례는 activity를 런칭 할 때 입니다. 그 과정에서 Intent는 activity들 사이에서 풀 같은 역할을 합니다. Intent는 근본적으로 수행 될 action에 대한 추상적인 묘사를 홀드하고 있는 passive data 입니다.
Structure
Intent를 구성하는 가장 주요한 요소는 다음과 같습니다:
- action - ACTION_VIEW, ACTION_EDIT, ACTION_MAIN 와 같이 수행될 action을 의미합니다.
- data - 연락처 데이터베이스의 사용제 레코드와 같이 작업할 android.net.Uri로 표현된 데이터를 의미합니다.'
Examples of action/data pairs 생략
Intent에 포함할 수 있는 attribute는 위의 정보 외에도 다음과 같이 더 존재합니다.
- category - 실행될 action에 대한 추가적인 정보를 의미합니다.
- type - Intent data의 명시적인 타입을 의미합니다.
- component - Intent를 위해 사용할 component class의 명시적인 이름을 의미합니다.
- extra - 추가적인 정보의 Bundle 입니다. component에 추가적인 정보를 제공하기 위해 사용됩니다.
Resolution
Intent에는 두가지 형태가 존재합니다.
- Explicit Intents setComponent나 setClass를 이용해 실행될 class를 구체화합니다. 때때로 explicit intents는 아무런 정보를 포함하지 않으며, 단순히 사용자가 어플리케이션과 상호 작용할 때 앱이 가지는 다양한 내부 activities을 런치할 수 있는 수단이 됩니다.
- Implicit Intents는 component를 구체화하지 않는 대신, 어떤 사용 가능한 component가 해당 intent를 위해 사용되기에 가장 적합한지 시스템이 결정할 수 있도록 충분한 정보를 포함하고 있어야 합니다.
Implicit intents를 사용할 때 우리는 해당 임의의 intents를 어떻게 해야 하는지 알아야 합니다. 이것은 Intent resolution의 과정에 의해 처리되며, 그 과정에서 Intent는 자신을 핸들하는 android.app.Activity, BroadcastReceiver, or android.app.Service (or 때때로 두 개 혹은 더 많은 activities/receivers)와 매핑됩니다.
Intent resolution 메커니즘은 근본적으로 설치된 앱 패키지의 <intent-filter>의 설정에 대해 intent를 일치시키는 것에 중점을 둡니다.
Resolution에 사용되는 3가지 요소가 Intent에 존재합니다: action, type 그리고 category. 이 정보들을 사용하여 쿼리는 해당 intent를 핸들하는 component를 위한 PackageManager에서 수행됩니다. 적당한 component는 AndroidManifest.xml에서 제공되는 intent 정보를 사용하여 결정됩니다.
'Android > API' 카테고리의 다른 글
Android - NotificationChannel (0) | 2023.02.17 |
---|