일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 보안
- gradle
- 노개북
- kotlin
- C++
- 코틀린
- 악성코드
- 리눅스
- ActiveMovieControl
- Android 4.1
- 하버드
- mime
- git
- linux
- 탐지기법
- ActiveX
- 안드로이드 개발
- Android
- OOM
- java
- 자바
- 구글
- KTS
- build.gradle
- Eclipse
- 개발
- 안철수
- 안드로이드
- c
- Today
- Total
꿈소년의 개발 이야기
Activity unregister / Leaked IntentReceiver issue 본문
refer to
This is a Android activity life cycle issue. I am seeing it in a main activity and then testing on device with the back button that goes back to a splash screen.
In the onPause() method.
Unregister the Broadcast Receiver that you created in the onCreate()
In the onRestart() re-register a brand new Broadcast Receiver.
In the activity class you need to keep a record of the Broadcast Receiver as instance data member.
SECOND
I think this also a feature enhancement issue with Android.
Sometimes developer need a broadcast receiver to outlive the activity. For example to understand when certain screen states are available or not. Think about a conversation context of work flow model, which has many states.
THIRD
You can register and unregister broadcast receivers with an activity, but a simple call like isRegistered(BroadcastReceiver) in the Activity class might be very useful.
If you need receivers to live beyond the activity, then I do not the answer, except to silence the warning, by adding unregister(X) in the onDestroy() call. YMMV ;-)
'Android Development' 카테고리의 다른 글
SQLiteOpenHelper Singleton instance creating. (0) | 2013.07.04 |
---|---|
ndk-stack 으로 so 파일 debugging 하기 (0) | 2013.05.13 |
NFC Guide (0) | 2013.05.08 |
리눅스 커널과 안드로이드의 Suspend/Resume (0) | 2013.03.30 |
DDMS thread dump (0) | 2013.03.30 |