Android Programming Tutorials

(Romina) #1
Asking Permission to Place a Call

Now, if you rebuild and reinstall the application, and try choosing the Call


option menu item, you will immediately "call" the phone number...which


will actually place a phone call if you are trying this on a device. The


emulator, of course, cannot place phone calls.


Extra Credit...............................................................................................


Here are some things you can try beyond those step-by-step instructions:



  • Add a preference to display the phone number instead of the


address in the restaurant list. Have the list detect the preference
and fill in the second line of the restaurant rows accordingly.


  • Push your APK file to a Web site that is configured to support the
    proper MIME type for Android application downloads (e.g.,
    Amazon S3). Try installing your APK onto a device from the


published location, to see how your requested permission appears
to end users at install time.


  • Find a revision to the layout-land version of detail_form.xml that
    does not clip the bottom radio button.


Further Reading........................................................................................


Permissions in general are covered in the "Requesting and Requiring


Permissions" chapter of The Busy Coder's Guide to Android Development.


Working with the telephony features of Android is briefly covered in the


"Handling Telephone Calls" chapter of the same book.


347
Free download pdf