I am trying to automatically answer an incoming call.
I am using the intent ACTION_ANSWER, but when a call arrives I can
only see an IndexOurOfBoundsException from JavaBinder. According to
the documentation it is possible to answer the call, but I cannot make
it.

Here is my code

public class MyPhoneStateListener extends PhoneStateListener {
        Context context;
        @Override
        public void onCallStateChanged(int state,String incomingNumber){
                 if (state==1){
                         Intent ic = new Intent(Intent.ACTION_ANSWER);
                         context.startActivity(ic);
                 }
}
---Main class :

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TelephonyManager telephonyManager
=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
        telephonyManager.listen(phoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
        phoneListener.context=this;
     }


--~--~---------~--~----~------------~-------~--~----~
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