I'm trying to have my program react to events such as when the phone
is ringing, busy, etc. I know it's not possible to replace the Phone
program, I just want to do some other stuff when the phone state
changes. According to the 1.5 docs, there is a BroadcastIntent called
ACTION_PHONE_STATE_CHANGED that carries the EXTRA_STATE, which seems
to be exactly what I want.

The documentation is here:
http://developer.android.com/reference/android/telephony/TelephonyManager.html#ACTION_PHONE_STATE_CHANGED

I want to register a Broadcast Receiver for this intent. I've included
the following lines in my Manifest:

-------------------------------------------------------------

<receiver android:name=".CallState">
            <intent-filter>
                <action
android:name="android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED" /
>
            </intent-filter>
        </receiver>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

-------------------------------------------------------------


And here is the CallState class:

-------------------------------------------------------------

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class CallState extends BroadcastReceiver{

        @Override
        public void onReceive(Context arg0, Intent arg1) {
                // TODO Auto-generated method stub
                Log.v("callState", "changed");


        }

}

-------------------------------------------------------------

However, my class is never called, either on the emulator or on a real
device using 1.5. Can anyone give me some insight into what I'm doing
wrong? Has anyone been able to react to phone calls without
registering a background service to poll the getCallState() method
repeatedly? Is this an error in the documentation, or is the broadcast
going out and I'm simply trying to capture it wrong?

Thanks for any help you guys can give me! This group has been a great
help since the beginning.

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

Reply via email to