SlideShare a Scribd company logo
Israel Ferrer
  Android Lover since 2008
     cofounder bubiloop
    cofounder android.es
  Barcelona GTUG Leader
   Android Dev at Fever
Head Mobile Dept. at ASMWS
 Computer Science at LaSalle
INTENTS
ARE AWESOME
   really, trust me!



                       Israel Ferrer
                            14th March
WHAT ARE

INTENTS
    ?
intent |inˈtent| noun
 intention or purpose:
with alarm she realized his
intent | a real intent to cut back
on social programs.




                                     flickr: chinesetealover
OK... WHAT DOES THIS REALLY MEAN?
Open new Screens
   Share with other apps
Open Camera to take a photo
    Open file manager
    Open the browser
  Open QR Code Scanner
             ...
HOW INTENTS

WORK
     ?
Explicit Intent


Implicit Intent



                  theatricalintelligence
EXPLICIT INTENTS

• Explicit
         Intent names the component which should be called
 by the Android system, using the Java class as identifier.

• Used   to open new activities in the same app.
         final Intent intent=new Intent(this, LoginActivity.class);
         startActivity(intent);
IMPLICIT INTENTS
• Implicitintent specifies the action to perform and optionally an
  URI for the action.

• Implicit
         Intent is managed by Android Intent resolution, which
  maps the intent to a Service, Activity or Broadcasts Receiver

• Thisresolution is done by matching intent with intentFilters of
  every app.

• Ifmore than one app can handle the action, the user will have
  to choose.
       final Intent intent=new Intent(Intent.ACTION_VIEW, "http://mylookout.com");
SHARE DATA

• Intents        can contain aditional data by using putExtra() method
  •       intent.putExtra(EXTRA_CONVERSATION, conversation);



• the
    receiving component can obtain this data by getExtras()
 method
      Bundle extras = getIntent().getExtras();
      String conversation = extras.getString(EXTRA_CONVERSATION);
      if (conversation != null) {
      	 // Do something with the data
      }
INTENT FILTERS
• AnIntentFilter specifies the types of Intent that an activity,
 service, or broadcast receiver can respond to. IntentFilters are
 declared in the Android Manifest.

• There   are 3 pieces of information used for this resolution:

 • Action

 • Type: mymeType      or scheme.

 • Category: need    to support DEFAULT to be found by
   startActivity.
INTENT FILTERS
Intent
final Intent intent=new Intent(Intent.ACTION_VIEW, "http://mylookout.com");



IntentFilter
<activity android:name=".BrowserActivitiy" android:label="@string/app_name">
  <intent-filter>
     <action android:name="android.intent.action.VIEW" />
     <category android:name="android.intent.category.DEFAULT" />
     <data android:scheme="http"/>
  </intent-filter>
</activity>
TO SUM UP

• Explicit: choose    the component to call.

• Implicit: isa general intent with action and optionally URI.
 The Intent resolution call the component that can handle it.

• Intents   can share data between components and apps.
HOW TO

USE
INTENTS
   ?
• Reuse   code and functionality from 3rd party apps

 • ACTION_SEND

 • ACTION_VIEW

   • geo:lat,lon   to open map

   • http://host   to open browser

   • tel:number    to open dialer
• Define    a set of intents to handle web addresses.

• Example: Twitter

  • Define    IntentFilter to handle twitter urls

   <activity android:name=".UrlHandleActivity" android:label="@string/app_name">
     <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:host="www.twitter.com" android:scheme="http" />
     </intent-filter>
   </activity>
• Check   the URL path to fire target Activity
   public void onCreate(Bundle savedInstanceState)
   	   {
   	     super.onCreate(savedInstanceState);
   	
   	     Uri uri = getIntent().getData();
   	     if (null == uri) {
   	       // Shouldn't happen. Handle errors.
   	       finish();
   	       return;
   	     }

   	    String path = uri.getPath();
   	    for (Pair<String, Class> pair : DISPATCH_MAP) {
   	      if (path.matches(pair.mFirst)) {
   	        Intent intent = new Intent(this, pair.mSecond);
   	        intent.setData(uri);
   	        startActivity(intent);
   	        finish();
   	        return;
   	      }
   	    }
   	   	    finish();
   	   }
   	   private static final List<Pair<String, Class>> DISPATCH_MAP
       = new LinkedList<Pair<String, Class>>();
   static {
     DISPATCH_MAP.add(new Pair<String, Class>("(.*)/status$",
       TweetActivity.class));
     DISPATCH_MAP.add(new Pair<String, Class>("/another/path",
       ProfileActivity.class));
   }
• Exposeintents to 3rd party apps. Example: Lookout public
 backup intent.
CONCLUSIONS
A core component of Android.
 A way to reuse functionality between apps.
         The glue between activities.
The mashup concept into a mobile platform
Intents are Awesome for users & developers
QUESTIONS?
Intents are Awesome

More Related Content

What's hot

Using intents in android
Using intents in androidUsing intents in android
Using intents in android
Oum Saokosal
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
Osahon Gino Ediagbonya
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
Jussi Pohjolainen
 
Android Components
Android ComponentsAndroid Components
Android Components
Aatul Palandurkar
 
Ppt 2 android_basics
Ppt 2 android_basicsPpt 2 android_basics
Ppt 2 android_basics
Headerlabs Infotech Pvt. Ltd.
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
Marcos Paulo Souza Damasceno
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
Raman Pandey
 
Event handling in Java(part 2)
Event handling in Java(part 2)Event handling in Java(part 2)
Event handling in Java(part 2)
RAJITHARAMACHANDRAN1
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recievers
Utkarsh Mankad
 
Android components
Android componentsAndroid components
Android components
NAVEENA ESWARAN
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
ma-polimi
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycle
Ahsanul Karim
 
Event handling in Java(part 1)
Event handling in Java(part 1)Event handling in Java(part 1)
Event handling in Java(part 1)
RAJITHARAMACHANDRAN1
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Android
ma-polimi
 
Android Components & Manifest
Android Components & ManifestAndroid Components & Manifest
Android Components & Manifest
ma-polimi
 
Android activity
Android activityAndroid activity
Android activity
Krazy Koder
 
Android
AndroidAndroid
Android
Pranav Ashok
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
Utkarsh Mankad
 
Lab1-android
Lab1-androidLab1-android
Lab1-android
Lilia Sfaxi
 

What's hot (19)

Using intents in android
Using intents in androidUsing intents in android
Using intents in android
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Android Components
Android ComponentsAndroid Components
Android Components
 
Ppt 2 android_basics
Ppt 2 android_basicsPpt 2 android_basics
Ppt 2 android_basics
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Event handling in Java(part 2)
Event handling in Java(part 2)Event handling in Java(part 2)
Event handling in Java(part 2)
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recievers
 
Android components
Android componentsAndroid components
Android components
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycle
 
Event handling in Java(part 1)
Event handling in Java(part 1)Event handling in Java(part 1)
Event handling in Java(part 1)
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Android
 
Android Components & Manifest
Android Components & ManifestAndroid Components & Manifest
Android Components & Manifest
 
Android activity
Android activityAndroid activity
Android activity
 
Android
AndroidAndroid
Android
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Lab1-android
Lab1-androidLab1-android
Lab1-android
 

Viewers also liked

Android intent
Android intentAndroid intent
Android intent
Krazy Koder
 
Android intents
Android intentsAndroid intents
Android intents
Siva Ramakrishna kv
 
Android Lecture #01 @PRO&BSC Inc.
Android Lecture #01 @PRO&BSC Inc.Android Lecture #01 @PRO&BSC Inc.
Android Lecture #01 @PRO&BSC Inc.
Yuki Higuchi
 
Level 1 &amp; 2
Level 1 &amp; 2Level 1 &amp; 2
Level 1 &amp; 2
skumartarget
 
Intent in android
Intent in androidIntent in android
Intent in android
Durai S
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)
Ted Liang
 
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 Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
Daniela Da Cruz
 
Android - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionAndroid - Intents - Mazenet Solution
Android - Intents - Mazenet Solution
Mazenetsolution
 
Android ppt
Android ppt Android ppt

Viewers also liked (10)

Android intent
Android intentAndroid intent
Android intent
 
Android intents
Android intentsAndroid intents
Android intents
 
Android Lecture #01 @PRO&BSC Inc.
Android Lecture #01 @PRO&BSC Inc.Android Lecture #01 @PRO&BSC Inc.
Android Lecture #01 @PRO&BSC Inc.
 
Level 1 &amp; 2
Level 1 &amp; 2Level 1 &amp; 2
Level 1 &amp; 2
 
Intent in android
Intent in androidIntent in android
Intent in android
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
 
Android - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionAndroid - Intents - Mazenet Solution
Android - Intents - Mazenet Solution
 
Android ppt
Android ppt Android ppt
Android ppt
 

Similar to Intents are Awesome

Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
Dr. Ramkumar Lakshminarayanan
 
ANDROID
ANDROIDANDROID
ANDROID
DrMeftahZouai
 
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
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
sunilsoni446112
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
AbdullahMunir32
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
Muhammad Sajid
 
Android - Android Intent Types
Android - Android Intent TypesAndroid - Android Intent Types
Android - Android Intent Types
Vibrant Technologies & Computers
 
Activity & Shared Preference
Activity & Shared PreferenceActivity & Shared Preference
Activity & Shared Preference
nationalmobileapps
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last sem
aswinbiju1652
 
Ch5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internetCh5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internet
Shih-Hsiang Lin
 
Android webinar class_3
Android webinar class_3Android webinar class_3
Android webinar class_3
Edureka!
 
How to integrate flurry in android
How to integrate flurry in androidHow to integrate flurry in android
How to integrate flurry in android
adityakumar2080
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.ppt
bharatt7
 
Hieu Xamarin iOS9, Android M 3-11-2015
Hieu Xamarin iOS9, Android M  3-11-2015Hieu Xamarin iOS9, Android M  3-11-2015
Hieu Xamarin iOS9, Android M 3-11-2015
Nguyen Hieu
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
34ShreyaChauhan
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
BirukMarkos
 
Tk2323 lecture 3 intent
Tk2323 lecture 3   intentTk2323 lecture 3   intent
Tk2323 lecture 3 intent
MengChun Lam
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
ssusere71a07
 
Pertemuan 03 - Activities and intents.pptx
Pertemuan 03 - Activities and intents.pptxPertemuan 03 - Activities and intents.pptx
Pertemuan 03 - Activities and intents.pptx
MUHAMMADRIFKIPERMANA2
 
Hello android world
Hello android worldHello android world
Hello android world
eleksdev
 

Similar to Intents are Awesome (20)

Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
 
ANDROID
ANDROIDANDROID
ANDROID
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
Android - Android Intent Types
Android - Android Intent TypesAndroid - Android Intent Types
Android - Android Intent Types
 
Activity & Shared Preference
Activity & Shared PreferenceActivity & Shared Preference
Activity & Shared Preference
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last sem
 
Ch5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internetCh5 intent broadcast receivers adapters and internet
Ch5 intent broadcast receivers adapters and internet
 
Android webinar class_3
Android webinar class_3Android webinar class_3
Android webinar class_3
 
How to integrate flurry in android
How to integrate flurry in androidHow to integrate flurry in android
How to integrate flurry in android
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.ppt
 
Hieu Xamarin iOS9, Android M 3-11-2015
Hieu Xamarin iOS9, Android M  3-11-2015Hieu Xamarin iOS9, Android M  3-11-2015
Hieu Xamarin iOS9, Android M 3-11-2015
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
 
Tk2323 lecture 3 intent
Tk2323 lecture 3   intentTk2323 lecture 3   intent
Tk2323 lecture 3 intent
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
 
Pertemuan 03 - Activities and intents.pptx
Pertemuan 03 - Activities and intents.pptxPertemuan 03 - Activities and intents.pptx
Pertemuan 03 - Activities and intents.pptx
 
Hello android world
Hello android worldHello android world
Hello android world
 

Recently uploaded

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
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
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

Intents are Awesome

  • 1. Israel Ferrer Android Lover since 2008 cofounder bubiloop cofounder android.es Barcelona GTUG Leader Android Dev at Fever Head Mobile Dept. at ASMWS Computer Science at LaSalle
  • 2. INTENTS ARE AWESOME really, trust me! Israel Ferrer 14th March
  • 4. intent |inˈtent| noun intention or purpose: with alarm she realized his intent | a real intent to cut back on social programs. flickr: chinesetealover
  • 5. OK... WHAT DOES THIS REALLY MEAN?
  • 6. Open new Screens Share with other apps Open Camera to take a photo Open file manager Open the browser Open QR Code Scanner ...
  • 8. Explicit Intent Implicit Intent theatricalintelligence
  • 9. EXPLICIT INTENTS • Explicit Intent names the component which should be called by the Android system, using the Java class as identifier. • Used to open new activities in the same app. final Intent intent=new Intent(this, LoginActivity.class); startActivity(intent);
  • 10. IMPLICIT INTENTS • Implicitintent specifies the action to perform and optionally an URI for the action. • Implicit Intent is managed by Android Intent resolution, which maps the intent to a Service, Activity or Broadcasts Receiver • Thisresolution is done by matching intent with intentFilters of every app. • Ifmore than one app can handle the action, the user will have to choose. final Intent intent=new Intent(Intent.ACTION_VIEW, "http://mylookout.com");
  • 11. SHARE DATA • Intents can contain aditional data by using putExtra() method • intent.putExtra(EXTRA_CONVERSATION, conversation); • the receiving component can obtain this data by getExtras() method Bundle extras = getIntent().getExtras(); String conversation = extras.getString(EXTRA_CONVERSATION); if (conversation != null) { // Do something with the data }
  • 12. INTENT FILTERS • AnIntentFilter specifies the types of Intent that an activity, service, or broadcast receiver can respond to. IntentFilters are declared in the Android Manifest. • There are 3 pieces of information used for this resolution: • Action • Type: mymeType or scheme. • Category: need to support DEFAULT to be found by startActivity.
  • 13. INTENT FILTERS Intent final Intent intent=new Intent(Intent.ACTION_VIEW, "http://mylookout.com"); IntentFilter <activity android:name=".BrowserActivitiy" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="http"/> </intent-filter> </activity>
  • 14. TO SUM UP • Explicit: choose the component to call. • Implicit: isa general intent with action and optionally URI. The Intent resolution call the component that can handle it. • Intents can share data between components and apps.
  • 16. • Reuse code and functionality from 3rd party apps • ACTION_SEND • ACTION_VIEW • geo:lat,lon to open map • http://host to open browser • tel:number to open dialer
  • 17. • Define a set of intents to handle web addresses. • Example: Twitter • Define IntentFilter to handle twitter urls <activity android:name=".UrlHandleActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="www.twitter.com" android:scheme="http" /> </intent-filter> </activity>
  • 18. • Check the URL path to fire target Activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Uri uri = getIntent().getData(); if (null == uri) { // Shouldn't happen. Handle errors. finish(); return; } String path = uri.getPath(); for (Pair<String, Class> pair : DISPATCH_MAP) { if (path.matches(pair.mFirst)) { Intent intent = new Intent(this, pair.mSecond); intent.setData(uri); startActivity(intent); finish(); return; } } finish(); } private static final List<Pair<String, Class>> DISPATCH_MAP = new LinkedList<Pair<String, Class>>(); static { DISPATCH_MAP.add(new Pair<String, Class>("(.*)/status$", TweetActivity.class)); DISPATCH_MAP.add(new Pair<String, Class>("/another/path", ProfileActivity.class)); }
  • 19. • Exposeintents to 3rd party apps. Example: Lookout public backup intent.
  • 21. A core component of Android. A way to reuse functionality between apps. The glue between activities. The mashup concept into a mobile platform Intents are Awesome for users & developers