7. 7
Android vs. Windows
type Android Windows
CPU optimal fast
battery small power supply
memory
mobile DRAM
small
DRAM
large
message handler
message (Message)
or action (String)
message (int)
termination app lifecycle permanent
function call call & proceed
call & wait
or call & proceed
9. 9
Android Msg Handler
• Message: containing a description and arbitrary
data object
• Runnable: a command that can be executed
• Handler: allows you to send and process Message
and Runnable
• Looper: used to run a message loop for a thread
13. 13
PhoneStateListner
• Monitors changes in specific telephony
states on the device, including service state,
signal strength, message waiting indicator
(voicemail).
Activity
Context
PhoneStateListener
OS
TelephonyManager
listen()
14. 14
Broadcast Receiver
• An Intent-based publish-
subscribe mechanism.
• Great for listening system
events such as SMS messages.
□ Courtesy to Everything of Android, slideshare.
15. 15
BR vs. Listener
type BroadcastReceiver Listener
goal class for Intents
class or interface
for Intents &
others
message
mostly global
messages
mostly specific
messages
period
discontinuous
reception
frequent (or
continuous) reception
construction
static (manifest) or
dynamic
dynamic only