URL : http://aroundck.tistory.com/213
.....
void onReceive (Context context, Intent intent)
: Broadcast가 수신되면 onReceive 메서드가 자동 호출됩니다.
BR은 메인 스레드에서 실행. 따라서 10초 이내로 return 해야 합니다. 아니면 system이 강제로 이 receiver를 죽이거나, ANR 이 발생합니다. |
.....
void sendBroadcast (Intent intent [, String receiverPermission])
void sendOrderedBroadcast (Intent intent, String receiverPermission)
: permission 필요 없을 경우 null 전달
: sendOrderedBroadcast()에서 밠행한 Intent의 Broadcast 수신 순서는 android:priority 속성이 지정하는 중요도에 따라 수신 순서가 결정
.....
Intent registerReceiver (BroadcastReceiver receiver, IntentFilter filter)
void unregisterReceiver (BraodcastReceiver receiver)
: BR 등록 최적의 시점은 onResume이며 등록 해제할 최적 시점은 onPause() 이다.
URL : http://csjung.tistory.com/20
브로드캐스팅 인텐트를 위한 메서드
sendBroadcast(Intent intent)
: 인텐트를 브로드케스팅하기 위한 기본 형식.
sendBroadcast(Intent intent, String receiverPermission)
: 브로드캐스트 수신을 위해 리시버들이 반드시 선언해야 하는 퍼미션 문자열과 같이 인텐트를 브로드 캐스팅 함.
sendStickyBroadcast(Intent intent)
: 브로드 케스팅된 뒤 일정 기간동안 수신자들이 데이터를 검색할 수 있게 함. 이 기능을 사용하려면 반드시 'BROADCAST_STICKY'퍼미션을 사용하여 선언해야 함.
sendOrderedBroadcast(Intent intent, String receiverPermission)
: 인텐트를 브로드캐스팅하여 리시버들을 차례대로 호출함.
sendOrderedBroadcast(Intent intent String receiverPermission, BroadcastReceiver
resultReceiver, Handler scheduler, int initialCode,
String initialData, Bundle initialExtras)
: 인텐트를 브로드캐스팅한 후 브로드캐스팅 리시버에서 리턴 값을 얻을 수 있음.
모든 리시버들은 브로드 캐스트 리시버 리턴 시에 데이터를 추가하여 보낼 수 있음.
이 메서드를 사용할 때에는 리시버들은 순서(AndroidManifest의 android:priority)대로 호출 됨.
URL : http://www.masterqna.com/android/12619/abortbroadcast-%EC%A7%88%EB%AC%B8
....
Sets the flag indicating that this receiver should abort the current broadcast; only works with broadcasts sent through Context.sendOrderedBroadcast. This will prevent any other broadcast receivers from receiving the broadcast. It will still call onReceive(Context, Intent) of the BroadcastReceiver that the caller of Context.sendOrderedBroadcast passed in. This method does not work with non-ordered broadcasts such as those sent with Context.sendBroadcast |
'Programming > Android Java' 카테고리의 다른 글
안드로이드 단말기 정보 얻기 (IMEI, IMSI, MSISDN 등등) (0) | 2014.08.24 |
---|---|
onNewIntent() 알아보기 (0) | 2014.08.24 |
Processing Ordered Broadcasts (0) | 2014.08.24 |
android wear관련 모듬 (0) | 2014.08.17 |
단순한 NFC 태그 읽기 쓰기 기능 사용법에 관한 고찰 (0) | 2014.08.17 |