Open Intents - Android Intents Mechanism and Dependency Management

6,999 views

Published on

Presentation about Android's Intent system, the intent registry from OpenIntents as well as the dependency manager currently developed.

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total views
6,999
On SlideShare
0
From Embeds
0
Number of Embeds
33
Actions
Shares
0
Downloads
127
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

Open Intents - Android Intents Mechanism and Dependency Management

  1. Open Intents Android Intents Mechanism Friedger Müffke @fmdroid #openintents www.openintents.org support@openintents.org FOSDEM, February 6, 2010
  2. Outline ● Android intents and intents filter ● OpenIntents ● Dependency and intents manager
  3. Android Platform
  4. No monoliths .. but interconnected components All apps are equal!
  5. Modular Apps ● Activity UI for one focused endeavor ● Service no UI, used for long running processes ● Broadcast receiver receives announcements ● Content provider makes data available
  6. Intents (1) Web browser Android Intents: Intents: VIEW + www.google.com VIEW + www.google.com VIEW + Contact VIEW + Image DIAL + 123 PICK + Image EDIT + Contact SEND + Note ..... Intent = Action + Data (+ Extras + Categories + Flags)
  7. Intents (2) ● Transition and messaging between components within application and beyond ● Source component + target component + data ● Expected behaviour, e.g. TAKE_PICTURE ● Used throughout the system ● Explicit vs. implict intents Named target or Tests against intent filters
  8. Intent filters (1) ● Advertising functionality of compontent ● Registered at install / start up time part of Manifest.xml ● Define tests for implicit intents ● Multiple filters of component are ORed
  9. Intent filters (2) ● Action test e.g. TAKE_PICTURE One must match Intent without action always accepted ● Data / Mime-type test e.g. content://contacts/people/1 geo:0,0?q=Pizza image/jpeg text/html filters with wildcards match everything specified content: and file: schema implicitly supported
  10. Intent filters (3) ● Category test e.g. CATEGORY_DEFAULT, CATEGORY_BROWSABLE All categories must match Intents for activities always include CATEGORY_DEFAULT ● User can choose if more than one target found ● Exception if no target found
  11. Manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="org.openintents.shopping.ShoppingActivity" android:icon="@drawable/small_pic.png" android:label="@string/shopping" . . . > <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.INSERT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType = "vnd.android.cursor.dir/vnd.openintents.shopping.item" /> </intent-filter> </activity> <service . . ./> . . . <uses-permisson . . . /> <uses-library . . . /> </application> </manifest>
  12. In Practice e.g. in Activity Intent i = new Intent(Intent.ACTION_VIEW); i.setData(„http://www.openintents.org“); this.startActivity(i); this.startActivityForResult(i, RESCODE); this.startService(i); this.bindService(i, con, 0); this.sendBroadcast(i);
  13. Benefits ● Focus on core functionality ● Reuse ● Exchange system components, e.g. home screen, keyboard, address book, dialer ● Automatic handling Tasks, plug-ins, menus, live folders Don't forget performance and security!
  14. OI Extensions OI applications work together OI Voice notes OI Notepad OI Shopping list OI Delete all OI Convert CSV OI About OI Safe OI File manager
  15. Create new intents Every developer can create their own new intents: VIEW SHOW DISPLAY EXHIBIT EXPOSE REVEAL The Tower of Babel by Pieter Brueghel the Elder (1563)
  16. OpenIntents.org ● Discussion group since 2007 ● All about open applications and interoperability ● Open source ● List of Android libraries ● Intents registry ● Backed by OpenIntents UG (haftungsbeschränkt) – Closed source apps – Organizer of droidcon
  17. Intent registry www.openintents.org Browse and find intents, actions, applications, URIs, extras Promote your own intents and applications As of January 2010: >50 registered intents Reuse components! Don't reinvent the wheel!
  18. Dependency Manager (1) ● Intents create dependencies between components ● Standard implementation: – run-time dependency check late binding – nearly constantly connected – Programs handles missing components e.g. direct user to app store or explain missing feature
  19. Dependency Manager (2) ● Components that rely on dependent components – A la distro package managers – Light-weight, late binding still possible – Helper library – Declaration in Manifest.xml uses-intent ● Resolution helper with UI – Interface to various sources, e.g. app stores, personal listings, etc.
  20. droidcon 2010 Brussels, Berlin Barcelona, London All information at droidcon.be and droidcon.de Free barcamp Conference Participate as speaker, sponsor or attendee Get in touch with Android community and decision makers Present and discuss ideas and results
  21. More info Web site: www.openintents.org Developer group: http://groups.google.com/group/openintents Code repository: http://openintents.googlecode.com Twitter: http://twitter.com/openintents

×