[PDF] Android Development Android. Notifications. 23. Victor Matos.





Previous PDF Next PDF



Cover page

This tutorial will teach you the basic Android programming and will also take you through some advance concepts related to Android application development.



flutter_tutorial.pdf

This tutorial walks through the basics of Flutter framework installation of Flutter SDK



Android-UI-Design.pdf

Android's user interface is based on direct manipulation using touch inputs that loosely correspond to real-world actions



Android File System

system tutorial. Page 4. File System. ? There are mainly 6 partitions in Android.



React Native - Tutorialspoint

This tutorial is designed for JavaScript and React developers who aspire to learn mobile Platforms – React Native supports IOS and Android platform.



Tutorial: Programming in Java for Android Development

Tutorial: Programming in Java for Android Development Install Android Studio directly (Windows Mac); unzip to directory ... javaReview.ppt.



Android Development

Android. Notifications. 23. Victor Matos. Cleveland State University. Notes are based on: Android Developers http://developer.android.com/index.html 



EDITING YOUR VIDEO USING KINEMASTER

EDITING YOUR VIDEO. USING KINEMASTER. Page 2. Main view. Create edit. Tutorials. Store. Settings. Previous edits. Page 3. Ratio aspects. Page 4. Options 



Android Development

Android – SQL Databases. SQL Databases. 4. How to create a SQLite database? Method 1 public static SQLiteDatabase.openDatabase (.



MOBILE APPLICATION DEVELOPMENT

24-Jun-2008 Android. ? BlackBerry. ? OVI. ? Windows Mobile. ? iPhone. ? LiMo. ? Ångström distribution. ? Adobe Flash Light. ? BREW. ? OpenMoko.

Android

Notifications

23

Victor Matos

Cleveland State University

Notes are based on:

Android Developers

http://developer.android.com/index.html 222

20. Android -NotificationsNotifications

2

What is a Notification?

A notificationis a short message briefly displayed on the status line. It typically announces the happening of an special event for which a trigger has been set. After opening the Notification Panelthe user may choose to click on a selection and execute an associated activity. 333

20. Android -NotificationsNotifications

3

What is a Notification?

Notification shown

on the status line

Drag down

Click on

Notification

Panel to

execute associated application 444

20. Android -NotificationsNotifications

4

Notification Manager

This class notifies the user of events that happen in the background.

Notifications can take different forms:

1.A persistent icon that goes in the status bar and is accessible through the

launcher, (when the user selects it, a designated Intent can be launched),

2.Turning on or flashing LEDs on the device, or

3.Alerting the user by flashing the backlight, playing a sound, or vibrating.

555

20. Android -NotificationsNotifications

5

Notification Manager

You do not instantiate this class directly; instead, retrieve it through getSystemService( String ).

Example:

String servName= Context.NOTIFICATION_SERVICE;

notificationManager= (NotificationManager) getSystemService(servName); 666

20. Android -NotificationsNotifications

6

Notification

This class represents how a persistent notification is to be presented to the user using the NotificationManager. public Notification(inticon, CharSequencetickerText, long when)

Parameters

iconThe resource id of the icon to put in the status bar. tickerTextThe text that flows by in the status bar when the notification first activates. whenThe time to show in the time field.

In the System.currentTimeMillistimebase.

777

20. Android -NotificationsNotifications

7

Notification -Methods

public void notify(intid, Notification notification) Places a persistent notification on the status bar.

Parameters

idAn identifier for this notification unique within your application. notificationA Notification object describing how to notify the user, other than the view you're providing.

Must not be null.

888

20. Android -NotificationsNotifications

8

Notification -Methods

public void setLatestEventInfo(

Context context, CharSequencecontentTitle,

CharSequencecontentText, PendingIntentcontentIntent) Sets the contentViewfield to be a view with the standard "Latest Event" layout.

Parameters

context The context for your application / activity. contentTitleThe title that goes in the expanded entry. contentTextThe text that goes in the expanded entry. contentIntentThe intent to launch when the user clicks the expanded notification. 999

20. Android -NotificationsNotifications

9

Notification -Methods

public void cancel ( intid ) public void cancelAll( ) Cancel a previously shown notification. If it's transient, the view will be hidden. If it's persistent, it will be removed from the status bar.

Parameters

IdAn identifier for this notification unique within your application.

101010

20. Android -NotificationsNotifications

10

Example.

Produce a notification. Allow the user to click on the Notification Panel and execute appropriate activity to attend the message.

111111

20. Android -NotificationsNotifications

11

Example -Layouts

main.xmlmain2.xml

121212

20. Android -NotificationsNotifications

12

Example -Manifest/drawable

btn_star_big_on_selected.png Note:

Obtain the icon from the folder

C:\Android\platforms\android-

1.x\data\res\drawable

131313

20. Android -NotificationsNotifications

13

Example -Create & Cancel a Notification

packagecis493.demos; importandroid.app.Activity; importandroid.app.Notification; importandroid.app.NotificationManager; importandroid.app.PendingIntent; importandroid.content.Context; importandroid.content.Intent; importandroid.os.Bundle; importandroid.view.View; importandroid.view.View.OnClickListener; importandroid.widget.*; publicclassNotifyDemo1 extendsActivity {

Button btnGo;

Button btnStop;

intnotificationId= 1;

NotificationManagernotificationManager;

@Override publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

141414

20. Android -NotificationsNotifications

14

Example -Create & Cancel a Notification

btnGo= (Button)findViewById(R.id.btnGo); btnGo.setOnClickListener(newOnClickListener() { publicvoidonClick(View v) { //define a notification manager

String serName= Context.NOTIFICATION_SERVICE;

notificationManager= (NotificationManager)getSystemService(serName); //define notification using: icon, text, and timing. inticon = R.drawable.btn_star_big_on_selected; String tickerText= "1. My Notification TickerText"; longwhen = System.currentTimeMillis(); Notification notification= newNotification(icon, tickerText, when); //configure appearance of the notification

String extendedTitle= "2. My Extended Title";

String extendedText= "3. This is an extended and very important message"; // set a Pending Activity to take care of the potential request the user // may have by clicking on the notification asking for more explanations Intentintent= newIntent(getApplicationContext(), NotifyHelper.class); intent.putExtra("extendedText", extendedText); intent.putExtra("extendedTitle", extendedTitle);

PendingIntentlaunchIntent=

151515

20. Android -NotificationsNotifications

15

Example -Create & Cancel a Notification

extendedTitle, extendedText, launchIntent); //trigger notification notificationId= 1; notificationManager.notify(notificationId, notification); }//click btnStop= (Button)findViewById(R.id.btnStop); btnStop.setOnClickListener(newOnClickListener() { publicvoidonClick(View v) { //canceling a notification notificationId= 1; }//onCreate }//NotifyDemo1

161616

20. Android -NotificationsNotifications

16

Example -SubActivity-Attending the Notification

packagecis493.demos; importandroid.app.Activity; importandroid.content.Intent; importandroid.os.Bundle; importandroid.widget.Toast; publicclassNotifyHelperextendsActivity { @Override protectedvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2);

Intent myData= getIntent();

// extract the extra-data in the Notification String msg= myData.getStringExtra("extendedTitle") + "\n" + myData.getStringExtra("extendedText"); Toast.makeText(getApplicationContext(), msg, 1).show(); 1717

20. Android -Notifications Notifications

17

Questions

quotesdbs_dbs14.pdfusesText_20
[PDF] android ui design course

[PDF] android ui design examples

[PDF] android ui design guidelines

[PDF] android ui design patterns

[PDF] android ui design ppt

[PDF] android ui design principles

[PDF] android ui design templates

[PDF] android ui design tool xml

[PDF] android ui design tutorial android studio

[PDF] android ui design with xml tutorial book pdf

[PDF] android ui framework

[PDF] android user interface pdf

[PDF] android workshop ppt

[PDF] android workshop syllabus

[PDF] android xml attributes list pdf