I noticed the former and current Android API documentation (with current 
being level 9) is lacking information about which API calls require which 
kind of permissions.
Neither the "official" permissions list at 
http://developer.android.com/reference/android/Manifest.permission.html nor 
the individual class documentation say a few words about it. Only some 
classes are documented this way, for instance the android.hardware.Camera 
API 
documentation<http://developer.android.com/reference/android/hardware/Camera.html>mentions
 "
*To access the device camera, you must declare the 
CAMERA<http://developer.android.com/reference/android/Manifest.permission.html#CAMERA>permission
 in your Android Manifest.
*"

Example. There is a permission called android.permission.VIBRATE . An 
application is required to declare this permission in its 
AndroidManifest.xml whenever there is a call to the 
android.os.Vibrator.vibrate()<http://developer.android.com/reference/android/os/Vibrator.html#vibrate%28long[],%20int%29>method.
 Probably, there are other classes and methods that require this 
permission. But the documentation is lacking means for looking up such 
requirements. Using android.os.Vibrator.vibrate() without declaring the 
VIBRATE permission results in a java.lang.SecurityException, with the 
application crashing. You can test this behavior with the ApiDemos, sub-demo 
"OS -> Morse Code", provided with the Android SDK.

To speed up development, I'd say its in the interest of all developers to 
document such permission requirements in the API documentation - preferable 
on the method granularity level, or at least on the class granularity level.

In case I missed a comprehensive 
which-class/method-requires-which-permission overview list, I thank you for 
posting it here.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to