SlideShare a Scribd company logo
Android Application Development
                        Broadcast Receiver


          Click to edit Master subtitle style




                                                             Ahsanul Karim
                                                ahsanul.karim@sentinelbd.com
                                                     Sentinel Solutions Ltd.
                                                   http://www.sentinelbd.com
5/21/11
Application Building Blocks
ly Corresponding to one screen.




     IntentReceiver Service          Activity      ContentProvider




ns or status changes.that runs in up your process. applications to share data.
       Faceless task Can wake the background.
                                           Enable




     5/21/11
Android Application Anatomy
                      Activities                                     Services
            1.    Provides User Interface                      1.   No User Interface
           2.    Usually represents a Single              2.      Runs in Background
                           Screen
                                                3.             Extends the Service Base
     3.         Can contain one/more Views                                Class
      4.         Extends the Activity Base
                           class
                            Application= Set of Android Components

      Intent/Broadcast Receiver                                 Content Provider
       1.    Receives and Reacts to                  1.        Makes application data
               broadcast Intents                             available to other apps
          2.  No UI but can start an            2.        Data stored in SQLite database
                     Activity                    3.        Extends the ContentProvider
                                                                    Base class
3.      Extends the BroadcastReceiver
     5/21/11       Base Class
Broadcast Receivers
1.   A broadcast receiver is a component that responds to system-wide
Broadcast announcements.
1.   Many broadcasts originate from the system—for example, a
Broadcast announcing that the screen has turned off, the battery
is low, or a picture was captured or an SMS is received.
1.   Applications can also initiate broadcasts—for example, to let other
Applications know that some data has been downloaded to the
device and is available for them to use.
1.   Although broadcast receivers don't display a user interface, they may
create a status bar notification to alert the user when a
broadcast event occurs.
1.   More commonly, though, a broadcast receiver is just a "gateway" to
other components and is intended to do a very minimal amount of
work. For instance, it might initiate a service/or start an activity to
perform some work based on the event.
      5/21/11
Android Application Anatomy


                      Activity 1             Activity 2

     UI



      Service                       BroadcastReceiver



           Intents
           1.   Directed Intents
           2.   Broadcast Intents                         OS

                   BIG PICTURE
 5/21/11
Broadcast Receivers
1. We’ll use a Broadcast Receiver to capture SMS receive event
2. We capture the SMS receive event and launch an Activity to show the sms and give user
an option to reply the SMS
                                                   Activity




                 OS                         BroadcastReceiver




     5/21/11
Broadcast Receivers
 1. Create a new project BroadcastReceiverDemo
 2. A broadcast receiver is implemented as a subclass of BroadcastReceiver and each
 broadcast is delivered as an Intent object. In this case the intent is detected by
 android.provider.Telephony.SMS_RECEIVED

 To do this we’ll create a class SMSReceiver that extends BroadcastReceiver class and
    define the method onReceive()




                                             BroadcastReceiver




      5/21/11
Broadcast Receivers (Contd.)
 3. We also need to add SMSReceiver as receiver of a particular Intent (SMS received)
 which is identified by android.provider.Telephony.SMS_RECEIVED




                                             BroadcastReceiver




  5/21/11
Broadcast Receivers (Contd.)
 4. Also we have to add permission for receiving SMS




                                             BroadcastReceiver




  5/21/11
Broadcast Receivers (Contd.)
 5. Now we run the application
 6. Now we use emulator control to send sms




  5/21/11
Sending SMS
  1. Add permission in menifest.xml



  2. We add the following code for sending SMS from anywhere of our application




  5/21/11
Exercise

 We’ll create a replica of SMS application of Android

 1.   Application will have a basic TabActivity with 3 tabs (Activities)
       1.  Send- will give user option to send sms (2 input fields for number and text)
 All sent SMS will be saved in database
       1.  Inbox- (List Activity) which will fetch all received SMS from database
       2.  Sent- (ListActivity) which will fetch all sent SMS
 1.   A broadcast receiver which will receive SMS and save them to database




      5/21/11

More Related Content

What's hot

Android 101
Android 101Android 101
Android 101
Pranay Airan
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
Jagdish Gediya
 
Unit2
Unit2Unit2
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
Marko Gargenta
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorial
nirajsimulanis
 
Mobile testing android
Mobile testing   androidMobile testing   android
Mobile testing android
Basant Dewangan
 
What’s new in Xcode 8? – Future of Native App Development Opportunities
What’s new in Xcode 8? – Future of Native App Development OpportunitiesWhat’s new in Xcode 8? – Future of Native App Development Opportunities
What’s new in Xcode 8? – Future of Native App Development Opportunities
Rigel Networks LLC
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recieversUtkarsh Mankad
 
android level 1
android level 1android level 1
android level 1
DevMix
 
Android architecture components
Android architecture components Android architecture components
Android architecture components
azzeddine chenine
 
Android session 2
Android session 2Android session 2
Android session 2
Ahesanali Suthar
 
Android session 1
Android session 1Android session 1
Android session 1
Ahesanali Suthar
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
mssaman
 
Android session 3
Android session 3Android session 3
Android session 3
Ahesanali Suthar
 
Android Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable DocumentationAndroid Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable Documentation
Nate Betz
 
Create your First Watchkit App
Create your First Watchkit AppCreate your First Watchkit App
Create your First Watchkit App
Pawan Ramteke
 
MobileAppDev Handout#2
MobileAppDev Handout#2MobileAppDev Handout#2
MobileAppDev Handout#2
trupti1976
 
Android notification
Android notificationAndroid notification
Android notificationKrazy Koder
 

What's hot (20)

Android 101
Android 101Android 101
Android 101
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
AndroidManifest
AndroidManifestAndroidManifest
AndroidManifest
 
Unit2
Unit2Unit2
Unit2
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorial
 
Mobile testing android
Mobile testing   androidMobile testing   android
Mobile testing android
 
What’s new in Xcode 8? – Future of Native App Development Opportunities
What’s new in Xcode 8? – Future of Native App Development OpportunitiesWhat’s new in Xcode 8? – Future of Native App Development Opportunities
What’s new in Xcode 8? – Future of Native App Development Opportunities
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recievers
 
android level 1
android level 1android level 1
android level 1
 
Android architecture components
Android architecture components Android architecture components
Android architecture components
 
Android session 2
Android session 2Android session 2
Android session 2
 
Google Android
Google AndroidGoogle Android
Google Android
 
Android session 1
Android session 1Android session 1
Android session 1
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
 
Android session 3
Android session 3Android session 3
Android session 3
 
Android Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable DocumentationAndroid Capstone Project, Final Deliverable Documentation
Android Capstone Project, Final Deliverable Documentation
 
Create your First Watchkit App
Create your First Watchkit AppCreate your First Watchkit App
Create your First Watchkit App
 
MobileAppDev Handout#2
MobileAppDev Handout#2MobileAppDev Handout#2
MobileAppDev Handout#2
 
Android notification
Android notificationAndroid notification
Android notification
 

Viewers also liked

Mcq peresentation
Mcq  peresentationMcq  peresentation
Mcq peresentation
Shah Jalal Hridoy
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location API
Ahsanul Karim
 
Action Bar Sherlock tutorial
Action Bar Sherlock tutorialAction Bar Sherlock tutorial
Action Bar Sherlock tutorial
Ahsanul Karim
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Ahsanul Karim
 
Training android
Training androidTraining android
Training android
University of Technology
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Ahsanul Karim
 
Day 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedDay 1 Android: Before Getting Started
Day 1 Android: Before Getting Started
Ahsanul Karim
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in BackgroundAhsanul Karim
 
Introduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting StartedIntroduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting Started
Ahsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentAhsanul Karim
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesLecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & Preferences
Ahsanul Karim
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Ui layout (incomplete)
Ui layout (incomplete)Ui layout (incomplete)
Ui layout (incomplete)Ahsanul Karim
 
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
Ahsanul Karim
 

Viewers also liked (16)

Mcq peresentation
Mcq  peresentationMcq  peresentation
Mcq peresentation
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location API
 
Action Bar Sherlock tutorial
Action Bar Sherlock tutorialAction Bar Sherlock tutorial
Action Bar Sherlock tutorial
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
Training android
Training androidTraining android
Training android
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
Day 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedDay 1 Android: Before Getting Started
Day 1 Android: Before Getting Started
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
 
Introduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting StartedIntroduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting Started
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Lecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & PreferencesLecture 5: Storage: Saving Data Database, Files & Preferences
Lecture 5: Storage: Saving Data Database, Files & Preferences
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Ui layout (incomplete)
Ui layout (incomplete)Ui layout (incomplete)
Ui layout (incomplete)
 
Client-Server
Client-ServerClient-Server
Client-Server
 
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
 

Similar to Day 6: Android BroadcastReceiver Component

Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
nationalmobileapps
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAhsanul Karim
 
Android broadcast receiver tutorial
Android broadcast receiver  tutorialAndroid broadcast receiver  tutorial
Android broadcast receiver tutorial
maamir farooq
 
Android broadcast receiver tutorial
Android broadcast receiver   tutorialAndroid broadcast receiver   tutorial
Android broadcast receiver tutorial
maamir farooq
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating system
Clément Escoffier
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
34ShreyaChauhan
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
avinash bhandari
 
Beginning android
Beginning android Beginning android
Beginning android
Igor R
 
Android application development
Android application developmentAndroid application development
Android application development
Md. Mujahid Islam
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
Arun David Johnson R
 
Android platform
Android platform Android platform
Android platform
Rashmi Warghade
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App Development
Abhijeet Gupta
 
Android Introduction by Kajal
Android Introduction by KajalAndroid Introduction by Kajal
Android Introduction by Kajal
Kajal Kucheriya Jain
 
04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)TECOS
 
Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications development
Alfredo Morresi
 
Android Basic- CMC
Android Basic- CMCAndroid Basic- CMC
Android Basic- CMC
Pragati Singh
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
javalabsf
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
Chandrakant Divate
 
Aptech Apps
Aptech Apps Aptech Apps
Aptech Apps
RasikaShinde6
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
Prajakta Dharmpurikar
 

Similar to Day 6: Android BroadcastReceiver Component (20)

Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Android broadcast receiver tutorial
Android broadcast receiver  tutorialAndroid broadcast receiver  tutorial
Android broadcast receiver tutorial
 
Android broadcast receiver tutorial
Android broadcast receiver   tutorialAndroid broadcast receiver   tutorial
Android broadcast receiver tutorial
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating system
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Beginning android
Beginning android Beginning android
Beginning android
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Android platform
Android platform Android platform
Android platform
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App Development
 
Android Introduction by Kajal
Android Introduction by KajalAndroid Introduction by Kajal
Android Introduction by Kajal
 
04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)
 
Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications development
 
Android Basic- CMC
Android Basic- CMCAndroid Basic- CMC
Android Basic- CMC
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Aptech Apps
Aptech Apps Aptech Apps
Aptech Apps
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 

More from Ahsanul Karim

লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:
Ahsanul Karim
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsAhsanul Karim
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsAhsanul Karim
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycleAhsanul Karim
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI WidgetsAhsanul Karim
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesAhsanul Karim
 
Mobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete StudyMobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete Study
Ahsanul Karim
 
Day1 before getting_started
Day1 before getting_startedDay1 before getting_started
Day1 before getting_started
Ahsanul Karim
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
Ahsanul Karim
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2
Ahsanul Karim
 

More from Ahsanul Karim (11)

লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:লেকচার ১ (ক)- শুরুর আগে:
লেকচার ১ (ক)- শুরুর আগে:
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycle
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through Activities
 
Mobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete StudyMobile Banking in Bangladesh: An Incomplete Study
Mobile Banking in Bangladesh: An Incomplete Study
 
List Views
List ViewsList Views
List Views
 
Day1 before getting_started
Day1 before getting_startedDay1 before getting_started
Day1 before getting_started
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2
 

Recently uploaded

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 

Recently uploaded (20)

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 

Day 6: Android BroadcastReceiver Component

  • 1. Android Application Development Broadcast Receiver Click to edit Master subtitle style Ahsanul Karim ahsanul.karim@sentinelbd.com Sentinel Solutions Ltd. http://www.sentinelbd.com 5/21/11
  • 2. Application Building Blocks ly Corresponding to one screen. IntentReceiver Service Activity ContentProvider ns or status changes.that runs in up your process. applications to share data. Faceless task Can wake the background. Enable 5/21/11
  • 3. Android Application Anatomy Activities Services 1. Provides User Interface 1. No User Interface 2. Usually represents a Single 2. Runs in Background Screen 3. Extends the Service Base 3. Can contain one/more Views Class 4. Extends the Activity Base class Application= Set of Android Components Intent/Broadcast Receiver Content Provider 1. Receives and Reacts to 1. Makes application data broadcast Intents available to other apps 2. No UI but can start an 2. Data stored in SQLite database Activity 3. Extends the ContentProvider Base class 3. Extends the BroadcastReceiver 5/21/11 Base Class
  • 4. Broadcast Receivers 1. A broadcast receiver is a component that responds to system-wide Broadcast announcements. 1. Many broadcasts originate from the system—for example, a Broadcast announcing that the screen has turned off, the battery is low, or a picture was captured or an SMS is received. 1. Applications can also initiate broadcasts—for example, to let other Applications know that some data has been downloaded to the device and is available for them to use. 1. Although broadcast receivers don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs. 1. More commonly, though, a broadcast receiver is just a "gateway" to other components and is intended to do a very minimal amount of work. For instance, it might initiate a service/or start an activity to perform some work based on the event. 5/21/11
  • 5. Android Application Anatomy Activity 1 Activity 2 UI Service BroadcastReceiver Intents 1. Directed Intents 2. Broadcast Intents OS BIG PICTURE 5/21/11
  • 6. Broadcast Receivers 1. We’ll use a Broadcast Receiver to capture SMS receive event 2. We capture the SMS receive event and launch an Activity to show the sms and give user an option to reply the SMS Activity OS BroadcastReceiver 5/21/11
  • 7. Broadcast Receivers 1. Create a new project BroadcastReceiverDemo 2. A broadcast receiver is implemented as a subclass of BroadcastReceiver and each broadcast is delivered as an Intent object. In this case the intent is detected by android.provider.Telephony.SMS_RECEIVED To do this we’ll create a class SMSReceiver that extends BroadcastReceiver class and define the method onReceive() BroadcastReceiver 5/21/11
  • 8. Broadcast Receivers (Contd.) 3. We also need to add SMSReceiver as receiver of a particular Intent (SMS received) which is identified by android.provider.Telephony.SMS_RECEIVED BroadcastReceiver 5/21/11
  • 9. Broadcast Receivers (Contd.) 4. Also we have to add permission for receiving SMS BroadcastReceiver 5/21/11
  • 10. Broadcast Receivers (Contd.) 5. Now we run the application 6. Now we use emulator control to send sms 5/21/11
  • 11. Sending SMS 1. Add permission in menifest.xml 2. We add the following code for sending SMS from anywhere of our application 5/21/11
  • 12. Exercise We’ll create a replica of SMS application of Android 1. Application will have a basic TabActivity with 3 tabs (Activities) 1. Send- will give user option to send sms (2 input fields for number and text) All sent SMS will be saved in database 1. Inbox- (List Activity) which will fetch all received SMS from database 2. Sent- (ListActivity) which will fetch all sent SMS 1. A broadcast receiver which will receive SMS and save them to database 5/21/11