Intents & Intent Filters. codeandroid.org

Similar documents
The Intent Class Starting Activities with Intents. Explicit Activation Implicit Activation via Intent resolution

The Intent Class Starting Activities with Intents. Explicit Activation Implicit Activation via Intent resolution

LECTURE NOTES OF APPLICATION ACTIVITIES

UNDERSTANDING ACTIVITIES

Handling App Links. Android Developers. This lesson teaches you to. See also

Android User Interface

Introduction To Android

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Programming with Android: Intents. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna

Programming with Android: Activities and Intents. Dipartimento di Informatica Scienza e Ingegneria Università di Bologna

Android User Interface Android Smartphone Programming. Outline University of Freiburg

stolen from Intents and Intent Filters

INTENTS android.content.intent

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming

Chapter 5 Defining the Manifest

Permissions. Lecture 18

Mobile Application Development Android

8Messaging SMS MESSAGING.

Multiple Activities. Many apps have multiple activities

FRAGMENTS.

Services. service: A background task used by an app.

Android Programming Lecture 7 9/23/2011

Embedded Systems Programming - PA8001

Real-Time Embedded Systems

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device

White Paper. Secure Coding for Android Applications

Android Activities. Akhilesh Tyagi

CS378 -Mobile Computing. Intents

LECTURE 12 BROADCAST RECEIVERS

OFFLINE MODE OF ANDROID

Introduction to Android Development

Android permissions Defining and using permissions Component permissions and related APIs

University of Waterloo Midterm Examination

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

Overview of Activities

University of Waterloo Midterm Examination Solutions

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 2

Termite WiFi Direct API

Application Fundamentals

Android Programming Lecture 8: Activities, Odds & Ends, Two New Views 9/28/2011

Sicurezza delle Reti e dei Sistemi Software a.a

Answers to Exercises

XML Tutorial. NOTE: This course is for basic concepts of XML in line with our existing Android Studio project.

12 Publishing Android Applications

Barcode Controller Scenario & Manual. Bluebird, inc. ver : 1.2

SHWETANK KUMAR GUPTA Only For Education Purpose

Activities. Repo:

Secure Coding for Android Applications

Android Services. Victor Matos Cleveland State University. Services

Interworking Guide for Android Samsung Apps

CS 234/334 Lab 1: Android Jump Start

This document providesanoverview ofthestepsrequired to implement an android app which will call the ACH android SDK.

Software Engineering Large Practical: Accessing remote data and XML parsing. Stephen Gilmore School of Informatics October 8, 2017

BITalino Java Application Programming Interface. Documentation Android API

CS434/534: Topics in Networked (Networking) Systems

Intents. 18 December 2018 Lecture Dec 2018 SE 435: Development in the Android Environment 1

App Development for Android. Prabhaker Matet

Android. Broadcasts Services Notifications

Security Philosophy. Humans have difficulty understanding risk

Basic UI elements: Defining Activity UI in the code. Marco Ronchetti Università degli Studi di Trento

A Tour of Android. and some of it s APIs. Bryan Noll

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

The Broadcast Class Registration Broadcast Processing

Using Eclipse for Android Development

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android?

Intents and Intent Filters

INTRODUCTION TO ANDROID

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking

PAPER ON ANDROID ESWAR COLLEGE OF ENGINEERING SUBMITTED BY:

Camera and Intent. Elena Fortini

Instructions on Yealink s SDK for Yealink T5 Smart Business Phone Series. Instructions on Yealink s SDK for Yealink T5 Smart Business Phone Series

Services Broadcast Receivers Permissions

CS378 -Mobile Computing. Services and Broadcast Receivers

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

VMware AirWatch Android SDK Technical Implementation Guide Empowering your enterprise applications with MDM capabilities using

Android. Operating System and Architecture. Android. Screens. Main features

CSCU9YH Development with Android

Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5

Podstawowe komponenty aplikacji, wymiana międzyprocesowa

Services. Background operating component without a visual interface Running in the background indefinitely

Android AND-401. Android Application Development. Download Full Version :

Android Application Development

Intents. Repo:

ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS

INTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based.

Instructions on Yealink s SDK for Yealink T5 Smart Media Phone Series. Instructions on Yealink s SDK for Yealink T5 Smart Media Phone Series

Lecture 08. Android Permissions Demystified. Adrienne Porter Felt, Erika Chin, Steve Hanna, Dawn Song, David Wagner. Operating Systems Practical

Practical Problem: Create an Android app that having following layouts.

Programming with Android: System Architecture. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu

Configuration changes runtime

<uses-permission android:name="android.permission.internet"/>

The Internet. CS 2046 Mobile Application Development Fall Jeff Davidson CS 2046

6.858 Quiz 2 Review. Android Security. Haogang Chen Nov 24, 2014

Programming Concepts and Skills. Creating an Android Project

Index. Numbers and Symbols

ANDROID APPS (NOW WITH JELLY BEANS!) Jordan Jozwiak November 11, 2012

Mobile Computing. Introduction to Android

Transcription:

Intents & Intent Filters codeandroid.org

Intents & Intents Filter Intents : request for an action to be performed (usually on a set of data) Intent Filters : register Activities, Services, and Broadcast Receivers (as being capable of performing an action on a set of data) Broadcast Receivers : listens to intents

Intents Support interaction between any application components available on an Android device start a new Activity broadcast messages (broadcast intents)

Intents Starting a new Activity Intent intent = new Intent (...);

Intents Starting a new Activity Dial a number Intent intent = new Intent (Intent.ACTION_DIAL, Uri.parse( tel:93675359 )); Launch a website Intent intent = new Intent (Intent.ACTION_VIEW, Uri.parse( http://codeandroid.org ));

Intents Starting a new Activity Launch an Activity Intent intent = new Intent (this, HelloWorld.class); Launch an Activity Intent intent = new Intent (this, HelloWorld.class); intent.putextra( title, Hello codeandroid );

Intent Filters AndroidManifest.xml <activity android:name=.helloworld android:label= @string/app_name > <intent-filter> <action android:name= android.intent.action.main /> <category android:name= android.intent.category.launcher /> </intent-filter> </activity> Launch Hello World Intent intent = new Intent (this, HelloWorld.class);

Intent Filters Required for Intent resolution to match Intents to Activities, Services, or BroadcastReceivers Most Intent Filters are declared in AndroidManifest.xml of an application

Intent Filters AndroidManifest.xml <activity android:name=.helloworld android:label= @string/app_name > <intent-filter> <action android:name= org.codeandroid.intentstest.helloworld /> <category android:name= android.intent.category.default /> </intent-filter> </activity> Launch Hello World Intent intent = new Intent ( org.codeandroid.intentstest.helloworld );

Intent Filters AndroidManifest.xml <activity android:name=.helloworld android:label= @string/app_name > <intent-filter> <action android:name= android.intent.action.view /> <category android:name= android.intent.category.default /> <category android:name= android.intent.category.browsable /> <data android:scheme= http android:host= androidium.org /> </intent-filter> </activity> Launch Hello World Intent intent = new Intent (Intent.ACTION_VIEW, Uri.parse( http://androidium.org ));

Intent Filters AndroidManifest.xml <activity android:name=.helloworld android:label= @string/app_name > <intent-filter> <action android:name= android.intent.action.view /> <category android:name= android.intent.category.default /> <category android:name= android.intent.category.browsable /> <data android:scheme= http android:host= www.google.com android:pathprefix= /advanced_search /> </intent-filter> </activity>

Intent Filters AndroidManifest.xml <activity android:name=.helloworld android:label= @string/app_name > <intent-filter> <action android:name= android.intent.action.view /> <category android:name= android.intent.category.default /> <category android:name= android.intent.category.browsable /> <data android:scheme= codeandroid /> </intent-filter> </activity> Launch Hello World Intent intent = new Intent (Intent.ACTION_VIEW, Uri.parse( codeandroid:// ));

Intents Launch the Android Market Uri marketuri = Uri.parse( http://market.android.com/search?q=pname:com.buuuk.buuuk ) Intent intent = new Intent (Intent.ACTION_VIEW, marketuri); Uri marketuri = Uri.parse( market://search?q=pname:com.buuuk.buuuk ) Intent intent = new Intent (Intent.ACTION_VIEW, marketuri);

Intents Broadcast Intents broadcast messages between components with the sendbroadcast method makes an application more open, by broadcasting to current and other applications

Intents Broadcast Intents Intent intent = new Intent( org.codeandroid.intentstest.testbroadcastreceiver ); sendbroadcast(intent);

Broadcast Receivers listen to Broadcast Intents must be registered (either in code or within the app manifest use Intent Filter to specify which Intents it is listening for

Broadcast Receivers registered inside code IntentFilter filter = new IntentFilter( org.codeandroid.intentstest.testbroadcastreceiver ); TestBroadcastReceiver receiver = new TestBroadcastReceiver(); registerreceiver(receiver, filter); public class TestBroadcastReceiver extends Broadcast Receiver { @Override public void onreceive(context context, Intent intent) { (... do something here...) } }

Broadcast Receivers register in app manifest <receiver android:name= CameraPressedReceiver > <intent-filter> <action android:name= android.intent.action.camera_button /> </intent-filter> </receiver> public class CameraPressed extends Broadcast Receiver { @Override public void onreceive(context context, Intent intent) { (... do something here...) } }