Improving docs on available Intents

61 views
Skip to first unread message

Jacob Nordfalk

unread,
Sep 5, 2012, 4:36:18 AM9/5/12
to android...@googlegroups.com
When doing Android training one inevitable question is "which intents can I use?".

I usually explain that there is more to it, that it depends on the devices capabilites etc. etc.... and that if Google APIs are available on the device they can use this list: http://developer.android.com/guide/appendix/g-app-intents.html ... and then I give them my own unofficial list.... and then I say 'go search stackoverflow', as the list of common intents is really way too short. In general the documentation about intents is about the general mechanisms, which is not what most developers needs to understand.

What I'd like to do is to modify the docs so
A) http://developer.android.com/guide/appendix/app-intents.html shows a list of common AOSP intents
B) http://developer.android.com/guide/appendix/g-app-intents.html shows a list of common Google intents
C) Interlink the pages and add a link from http://developer.android.com/reference/android/content/Intent.html 
D) Merge 'Intent URI' and 'Intent Action' columns to simply show the code needed, like in the examples below 

To A) I'd keep VIEW, WEB_SEARCH, CALL and DIAL and add intents for
* SMS
Intent i = new Intent(Intent.ACTION_VIEW);
i.setType("vnd.android-dir/mms-sms");
i.putExtra("sms_body", message);
i.putExtra("address", phone_number);

* Share intent
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_SUBJECT, "blabla");
i.putExtra(Intent.EXTRA_TEXT, "blabla");
i.setType("text/plain");

* Email
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_SUBJECT, subject);
i.putExtra(Intent.EXTRA_TEXT, text);
i.putExtra(Intent.EXTRA_EMAIL, new String[]{recipient});
i.setType("text/plain");
(with note: you’ll need to configure the email client. If the email client is not configured, it will not respond to the Intent)


* Pick contact
Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);

* Pick image from gallery 
Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);

* Capture image from camera
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);




I'd note that the list is for the AOSP phone implementation and that some might not be available on e.g. tablets.


To B) I'd remove common AOSP intents, keep the Google ones and 
* add Google Play intent.



Before making the patch I'd like to get opinions and suggestions.


--
Jacob Nordfalk
Androidudvikler og -underviser på IHK og Lund&Bendsen

Al Sutton

unread,
Sep 6, 2012, 3:15:34 AM9/6/12
to android...@googlegroups.com
You might want to work with the OpenIntents group who've been working on building an intent registry for a number of years; http://www.openintents.org/en/intentstable

Al.
-- 
Al Sutton - Funky Android Ltd.

T: @alsutton  

The views expressed in this email are those of the author and not necessarily those of Funky Android Limited, it's associates, or it's subsidiaries. 

--
 
 
 

Jacob Nordfalk

unread,
Sep 6, 2012, 12:24:14 PM9/6/12
to android...@googlegroups.com


2012/9/6 Al Sutton <a...@funkyandroid.com>

You might want to work with the OpenIntents group who've been working on building an intent registry for a number of years; http://www.openintents.org/en/intentstable


If OI had made a distinction between 

* intents that there is an overwhelming probability that are available in all reasonable devices (like that a certain SMS intent is supposed to work on all phone devices) and 

* intents that requires some 3rd party app installed which the user probably doesent have installed apriori, 

then the OI list would seem more usefull to me.

As it is now the OI intent list probably fine for some purposes, but it is not an more or less universal answer to the question "which intents can I use?". Answering that question should be the goal of the Android documentation ( http://developer.android.com/guide/appendix/app-intents.html ).


Al Sutton

unread,
Sep 7, 2012, 3:22:48 AM9/7/12
to android...@googlegroups.com
It might be worth suggesting that split to them, their mailing list is at https://groups.google.com/forum/?fromgroups=#!forum/openintents

My main concern is where overlap occurs. How would you handle the SHARE intent in your scheme?, it can be serviced by apps on a device without the GApps, but it is also the way to get content into the Google+ app to be shared.

I think that the two pages do need some work (e.g. is the browser considered a Google Android application?, I think most people would assume the Google Android applications are just things like GMail, Play Store, etc.), but I quite like how they're currently structured.

Al.
-- 
Al Sutton - Funky Android Ltd.

T: @alsutton  

The views expressed in this email are those of the author and not necessarily those of Funky Android Limited, it's associates, or it's subsidiaries. 

--
 
 
 

Reply all
Reply to author
Forward
0 new messages