android broadcast recievers pdf by apk855

VIEWS: 16 PAGES: 3

More Info
									                        Broad Cast
                        Receivers


BROADCAST RECIEVERS-1         Copyright © 2012,apkdownloads.in. All rights reserved
    • A broadcast receiver is a component that responds to
      system-wide broadcast announcements.
    • Many broadcasts originate from the system
    • For Example:
          The screen is turned off.
          The battery is low.
          A picture is captured.
    • Applications can also initiate the broadcasts.
    • For Example:
          Let other applications know that some data has been
           downloaded to the device and is available to use.
    • Like services , broadcast receivers don’t display a user
      interface.
    • They may create a status bar notification to alert the user
      when a broadcast event occurs.


BROADCAST RECIEVERS-2                   Copyright © 2012,apkdownloads.in. All rights reserved
    • A broad cast receiver is implemented as a subclass of
      BroadcastReceiver.
    • Each broad cast is delivers as an Intent object.
    • To create a user defined BroadcastReceiver , our class
      must extedns for BroadcastReceiver class of
          android.content.BroadcastReceiver.
    • For Example:
         Class MyReciever extends BroadcastReceiver{
         }
    • We need to override the following method.
      public void onReceive(Context context,Intent intent)
    • We need to configure this BroadcastReceiver in .xml file
      by using the following tag.
         <receiver android:name="MyPhoneReceiver">
         <intent-filter>
         <action android:name="android.intent.action.PHONE_STATE">
         </action>
         </intent-filter>
         </receiver>
BROADCAST RECIEVERS-3                          Copyright © 2012,apkdownloads.in. All rights reserved

								
To top