I\'m trying to make app to READ PHONE STATE
and when the phone state is changed to display Toast
with the current state. But when I start it, the a
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.marakana"
android:versionCode="1"
android:versionName="1.0" >
/* permission should be added like below*/
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light" >
<activity
android:name=".TelephonyDemo"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>
Your application knows PHONE STATE thanks an Intent that is Broadcasted by the Telephony Service notifying to application about PHONE STATE changes.
You may need Guide line to create your application
android.permission.READ_PHONE_STATE permission have to be added in your AndroidManifest.xml file (here an example extract..)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xyz...."
android:versionCode="1" android:versionName="0.1">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
...
</manifest>
I did not see <uses-permission android:name="android.permission.READ_PHONE_STATE" />
in your Manifest file.
It is required for your application to be able to read that state.