Android Programming Tutorials

(Romina) #1
Asking Permission to Place a Call

At this point, you can recompile and reinstall the application. When you


first run it, there will be a tiny pause as the database is updated. After that


point, you can use the new field to add phone numbers to whichever


restaurants you want:


Figure 60. The new DetailForm layout

Step #5: Ask for Permission to Make Calls.......................................


Then, we can update AndroidManifest.xml to put in a permission request to


be able to place phone calls:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="apt.tutorial"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application android:label="@string/app_name">
<activity android:name=".LunchList"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

343
Free download pdf