SlideShare a Scribd company logo
1
Android Notification
Topics
• Toast notification
• Status bar notification
• Dialog notification (we already covered this)
• Alarm manager
Toast Notification
Toast Notification
• A toast notification is a message
that pops up on the surface of the
window.
• It only fills the amount of space
required for the message and the
user's current activity remains
visible and interactive.
• The notification automatically
fades in and out, and does not
accept interaction events.
• Because a toast can be created
from a background Service, it
appears even if the application
isn't visible.
Toast Message
Toast.makeText(
getApplicationContext(), // Context
R.string.toast_message, // Get string resource to display
Toast.LENGTH_LONG).show(); // Make sure you call show()
Status Bar
Notification
Status Bar Notification
• A status bar notification adds an icon to the
system's status bar (with an optional ticker-
text message) and an expanded message
(notification detail) in the "Notifications"
window.
• When the user selects the expanded
message, Android fires an Intent that is
defined by the notification (usually to launch
an Activity).
• You can also configure the notification to alert
the user with a sound, a vibration, and
flashing lights on the device.
Icon and Ticker-text Message
Code that Displays Icon/Ticker-text
// Get a reference to the NotificationManager:
NotificationManager mNotificationManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
// Instantiate the Notification.
Notification mNotification = new Notification(R.drawable.android,
"New Alert, Pull me down to see Notification details!",
System.currentTimeMillis());
....
...
mNotificationManager.notify(SIMPLE_NOTFICATION_ID,
mNotification);
Expanded Message (Notification Detail)
• Appears when icon/ticker-text is pulled down
Code that Displays Expanded
Message (Notification Detail)
// Define the Notification's expanded message (notification detail)
// and Intent. The notification detail message is the one that gets
// displayed when a user drags the notification downward.
CharSequence contentTitle = "Notification Details.";
CharSequence contentText = "Go to JavaPassion.com by clicking me";
....
...
// Sets the contentView field to be a view with the standard "Latest Event"
// layout. "mPendingIntent" is an intent to launch when the user clicks
// the expanded notification
mNotification.setLatestEventInfo(getApplicationContext(),
contentTitle,
contentText,
mPendingIntent);
Activity That Gets Started When
Notification Detail is Clicked
Code that Starts an Activity when
Notification Detail is clicked
// The Intent is to define an action that gets executed when a
// user clicks the notification detail.
intent notifyIntent = new Intent(
android.content.Intent.ACTION_VIEW, Uri
.parse("http://www.javapassion.com"));
// The PendingIntent can be handed to other applications so that they can
// perform the action you described on your behalf at a later time.
// By giving a PendingIntent to another application, you are granting it the
// right to perform the operation you have specified as if the other application
// was yourself (with the same permissions and identity).
PendingIntent mPendingIntent = PendingIntent.getActivity(
StatusBarNotification.this, 0, notifyIntent,
android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
// Sets the contentView field to be a view with the standard "Latest Event"
// layout. "mPendingIntent" is an intent to launch when the user clicks
// the expanded notification
mNotification.setLatestEventInfo(getApplicationContext(),
contentTitle,
contentText,
mPendingIntent);
Alarm Manager Example
Thank you

More Related Content

What's hot

05 intent
05 intent05 intent
05 intent
Sokngim Sa
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
vishal choudhary
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
Kan-Han (John) Lu
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
CodeAndroid
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialog
Krazy Koder
 
Action Bar in Android
Action Bar in AndroidAction Bar in Android
Action Bar in Android
Prof. Erwin Globio
 
Android intents
Android intentsAndroid intents
Android intents
Siva Ramakrishna kv
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
Shakib Hasan Sumon
 
Event handling
Event handlingEvent handling
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
ma-polimi
 
Android Location and Maps
Android Location and MapsAndroid Location and Maps
Android Location and Maps
Jussi Pohjolainen
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
Soham Patel
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
Prawesh Shrestha
 
UI controls in Android
UI controls in Android UI controls in Android
UI controls in Android
DivyaKS12
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action bar
Diego Grancini
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
Jomar Tigcal
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_android
PRITI TELMORE
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
prabhu rajendran
 
Java awt
Java awtJava awt
Java awt
Arati Gadgil
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
Sergi Martínez
 

What's hot (20)

05 intent
05 intent05 intent
05 intent
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialog
 
Action Bar in Android
Action Bar in AndroidAction Bar in Android
Action Bar in Android
 
Android intents
Android intentsAndroid intents
Android intents
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Event handling
Event handlingEvent handling
Event handling
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
Android Location and Maps
Android Location and MapsAndroid Location and Maps
Android Location and Maps
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
UI controls in Android
UI controls in Android UI controls in Android
UI controls in Android
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action bar
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_android
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
Java awt
Java awtJava awt
Java awt
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
 

Viewers also liked

2310 b xd
2310 b xd2310 b xd
2310 b xd
Krazy Koder
 
Alertdialog in android
Alertdialog in androidAlertdialog in android
Alertdialog in android
Durai S
 
Android Dialogs Tutorial
Android Dialogs TutorialAndroid Dialogs Tutorial
Android Dialogs Tutorial
Perfect APK
 
Android Lab Test : Creating a dialog Yes/No (english)
Android Lab Test : Creating a dialog Yes/No (english)Android Lab Test : Creating a dialog Yes/No (english)
Android Lab Test : Creating a dialog Yes/No (english)
Bruno Delb
 
Android basic 3 Dialogs
Android basic 3 DialogsAndroid basic 3 Dialogs
Android basic 3 Dialogs
Eakapong Kattiya
 
Day1 what is android(print)
Day1 what is android(print)Day1 what is android(print)
Day1 what is android(print)
Dongchul Shin
 
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
Dr. Ramkumar Lakshminarayanan
 
ExtraAEdge - CollEDGE Product Demo
ExtraAEdge - CollEDGE Product DemoExtraAEdge - CollEDGE Product Demo
ExtraAEdge - CollEDGE Product Demo
theextraaedge
 
Android location
Android locationAndroid location
Android location
Krazy Koder
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
Krazy Koder
 
Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0
Gracia Marcom
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and Threading
Mohammad Shaker
 
Action Bar and Menu
Action Bar and MenuAction Bar and Menu
Action Bar and Menu
Katsumi Onishi
 
College management system
College management systemCollege management system
College management system
Aditya Kiran
 
You can win- a review
You can win- a reviewYou can win- a review
You can win- a review
Robin Varghese
 
Android ui menu
Android ui menuAndroid ui menu
Android ui menu
Krazy Koder
 
Creating Great Apps with MOTODEV Studio for Android
Creating Great Apps with MOTODEV Studio for AndroidCreating Great Apps with MOTODEV Studio for Android
Creating Great Apps with MOTODEV Studio for Android
Motorola Mobility - MOTODEV
 
Android fast track_course
Android fast track_courseAndroid fast track_course
Android fast track_courseAgus Haryanto
 
Android UI Development
Android UI DevelopmentAndroid UI Development
Android UI Development
Jussi Pohjolainen
 
Android Radio streaming
Android Radio streamingAndroid Radio streaming
Android Radio streaming
Agus Haryanto
 

Viewers also liked (20)

2310 b xd
2310 b xd2310 b xd
2310 b xd
 
Alertdialog in android
Alertdialog in androidAlertdialog in android
Alertdialog in android
 
Android Dialogs Tutorial
Android Dialogs TutorialAndroid Dialogs Tutorial
Android Dialogs Tutorial
 
Android Lab Test : Creating a dialog Yes/No (english)
Android Lab Test : Creating a dialog Yes/No (english)Android Lab Test : Creating a dialog Yes/No (english)
Android Lab Test : Creating a dialog Yes/No (english)
 
Android basic 3 Dialogs
Android basic 3 DialogsAndroid basic 3 Dialogs
Android basic 3 Dialogs
 
Day1 what is android(print)
Day1 what is android(print)Day1 what is android(print)
Day1 what is android(print)
 
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
 
ExtraAEdge - CollEDGE Product Demo
ExtraAEdge - CollEDGE Product DemoExtraAEdge - CollEDGE Product Demo
ExtraAEdge - CollEDGE Product Demo
 
Android location
Android locationAndroid location
Android location
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
 
Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and Threading
 
Action Bar and Menu
Action Bar and MenuAction Bar and Menu
Action Bar and Menu
 
College management system
College management systemCollege management system
College management system
 
You can win- a review
You can win- a reviewYou can win- a review
You can win- a review
 
Android ui menu
Android ui menuAndroid ui menu
Android ui menu
 
Creating Great Apps with MOTODEV Studio for Android
Creating Great Apps with MOTODEV Studio for AndroidCreating Great Apps with MOTODEV Studio for Android
Creating Great Apps with MOTODEV Studio for Android
 
Android fast track_course
Android fast track_courseAndroid fast track_course
Android fast track_course
 
Android UI Development
Android UI DevelopmentAndroid UI Development
Android UI Development
 
Android Radio streaming
Android Radio streamingAndroid Radio streaming
Android Radio streaming
 

Similar to Android notification

Notifications
NotificationsNotifications
Notifications
Youssef ELBOUZIANI
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
sunilsoni446112
 
Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification Tutorial
Ketan Raval
 
Android Training (Notifications)
Android Training (Notifications)Android Training (Notifications)
Android Training (Notifications)
Khaled Anaqwa
 
Android Wearables ii
Android Wearables iiAndroid Wearables ii
Android Wearables ii
Ketan Raval
 
Android notifications
Android notificationsAndroid notifications
Android notifications
Ketan Raval
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear Development
Takahiro (Poly) Horikawa
 
Lesson 9
Lesson 9Lesson 9
Lesson 9
CITSimon
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
Srajan Shukla
 
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
DicodingEvent
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
faiz324545
 
Android action bar and notifications-chapter16
Android action bar and notifications-chapter16Android action bar and notifications-chapter16
Android action bar and notifications-chapter16
Dr. Ramkumar Lakshminarayanan
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
kashyapneha2809
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
nehakumari0xf
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
teach4uin
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
maamir farooq
 
Androd Listeners
Androd ListenersAndrod Listeners
Androd Listeners
ksheerod shri toshniwal
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - Android
Wingston
 
08.Push Notifications
08.Push Notifications 08.Push Notifications
08.Push Notifications
Nguyen Tuan
 
Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...
naseeb20
 

Similar to Android notification (20)

Notifications
NotificationsNotifications
Notifications
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
 
Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification Tutorial
 
Android Training (Notifications)
Android Training (Notifications)Android Training (Notifications)
Android Training (Notifications)
 
Android Wearables ii
Android Wearables iiAndroid Wearables ii
Android Wearables ii
 
Android notifications
Android notificationsAndroid notifications
Android notifications
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear Development
 
Lesson 9
Lesson 9Lesson 9
Lesson 9
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
 
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
 
Android action bar and notifications-chapter16
Android action bar and notifications-chapter16Android action bar and notifications-chapter16
Android action bar and notifications-chapter16
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
 
Androd Listeners
Androd ListenersAndrod Listeners
Androd Listeners
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - Android
 
08.Push Notifications
08.Push Notifications 08.Push Notifications
08.Push Notifications
 
Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...
 

More from Krazy Koder

2310 b xd
2310 b xd2310 b xd
2310 b xd
Krazy Koder
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
Krazy Koder
 
2310 b xc
2310 b xc2310 b xc
2310 b xc
Krazy Koder
 
2310 b xb
2310 b xb2310 b xb
2310 b xb
Krazy Koder
 
2310 b 17
2310 b 172310 b 17
2310 b 17
Krazy Koder
 
2310 b 16
2310 b 162310 b 16
2310 b 16
Krazy Koder
 
2310 b 16
2310 b 162310 b 16
2310 b 16
Krazy Koder
 
2310 b 15
2310 b 152310 b 15
2310 b 15
Krazy Koder
 
2310 b 15
2310 b 152310 b 15
2310 b 15
Krazy Koder
 
2310 b 14
2310 b 142310 b 14
2310 b 14
Krazy Koder
 
2310 b 13
2310 b 132310 b 13
2310 b 13
Krazy Koder
 
2310 b 12
2310 b 122310 b 12
2310 b 12
Krazy Koder
 
2310 b 11
2310 b 112310 b 11
2310 b 11
Krazy Koder
 
2310 b 10
2310 b 102310 b 10
2310 b 10
Krazy Koder
 
2310 b 09
2310 b 092310 b 09
2310 b 09
Krazy Koder
 
2310 b 08
2310 b 082310 b 08
2310 b 08
Krazy Koder
 
2310 b 08
2310 b 082310 b 08
2310 b 08
Krazy Koder
 
2310 b 08
2310 b 082310 b 08
2310 b 08
Krazy Koder
 
2310 b 07
2310 b 072310 b 07
2310 b 07
Krazy Koder
 
2310 b 06
2310 b 062310 b 06
2310 b 06
Krazy Koder
 

More from Krazy Koder (20)

2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xc
2310 b xc2310 b xc
2310 b xc
 
2310 b xb
2310 b xb2310 b xb
2310 b xb
 
2310 b 17
2310 b 172310 b 17
2310 b 17
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 14
2310 b 142310 b 14
2310 b 14
 
2310 b 13
2310 b 132310 b 13
2310 b 13
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
2310 b 11
2310 b 112310 b 11
2310 b 11
 
2310 b 10
2310 b 102310 b 10
2310 b 10
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 07
2310 b 072310 b 07
2310 b 07
 
2310 b 06
2310 b 062310 b 06
2310 b 06
 

Recently uploaded

PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 

Recently uploaded (20)

PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 

Android notification

  • 2. Topics • Toast notification • Status bar notification • Dialog notification (we already covered this) • Alarm manager
  • 4. Toast Notification • A toast notification is a message that pops up on the surface of the window. • It only fills the amount of space required for the message and the user's current activity remains visible and interactive. • The notification automatically fades in and out, and does not accept interaction events. • Because a toast can be created from a background Service, it appears even if the application isn't visible.
  • 5. Toast Message Toast.makeText( getApplicationContext(), // Context R.string.toast_message, // Get string resource to display Toast.LENGTH_LONG).show(); // Make sure you call show()
  • 7. Status Bar Notification • A status bar notification adds an icon to the system's status bar (with an optional ticker- text message) and an expanded message (notification detail) in the "Notifications" window. • When the user selects the expanded message, Android fires an Intent that is defined by the notification (usually to launch an Activity). • You can also configure the notification to alert the user with a sound, a vibration, and flashing lights on the device.
  • 9. Code that Displays Icon/Ticker-text // Get a reference to the NotificationManager: NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Instantiate the Notification. Notification mNotification = new Notification(R.drawable.android, "New Alert, Pull me down to see Notification details!", System.currentTimeMillis()); .... ... mNotificationManager.notify(SIMPLE_NOTFICATION_ID, mNotification);
  • 10. Expanded Message (Notification Detail) • Appears when icon/ticker-text is pulled down
  • 11. Code that Displays Expanded Message (Notification Detail) // Define the Notification's expanded message (notification detail) // and Intent. The notification detail message is the one that gets // displayed when a user drags the notification downward. CharSequence contentTitle = "Notification Details."; CharSequence contentText = "Go to JavaPassion.com by clicking me"; .... ... // Sets the contentView field to be a view with the standard "Latest Event" // layout. "mPendingIntent" is an intent to launch when the user clicks // the expanded notification mNotification.setLatestEventInfo(getApplicationContext(), contentTitle, contentText, mPendingIntent);
  • 12. Activity That Gets Started When Notification Detail is Clicked
  • 13. Code that Starts an Activity when Notification Detail is clicked // The Intent is to define an action that gets executed when a // user clicks the notification detail. intent notifyIntent = new Intent( android.content.Intent.ACTION_VIEW, Uri .parse("http://www.javapassion.com")); // The PendingIntent can be handed to other applications so that they can // perform the action you described on your behalf at a later time. // By giving a PendingIntent to another application, you are granting it the // right to perform the operation you have specified as if the other application // was yourself (with the same permissions and identity). PendingIntent mPendingIntent = PendingIntent.getActivity( StatusBarNotification.this, 0, notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK); // Sets the contentView field to be a view with the standard "Latest Event" // layout. "mPendingIntent" is an intent to launch when the user clicks // the expanded notification mNotification.setLatestEventInfo(getApplicationContext(), contentTitle, contentText, mPendingIntent);