[android-developers] Re: how to accept a phone call programmitically

2012-05-18 Thread Pent
 Use the below code in the same package as specified and save as *
 ITelephony.aidl*

That's the method I had been using, but the needed permissions aren't
granted for most of the functions anymore.

  // Simulate a press of the headset button to pick up the

I'll give that a go, thanks.

Pent

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


[android-developers] Re: how to accept a phone call programmitically

2012-05-17 Thread Pent
 okay friends, I got it. Its working now.

Any tips ?

As far as I know that API needs a permission these days.

Pent

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


[android-developers] Re: how to accept a phone call programmitically

2012-05-17 Thread Pent
 As far as I know that API needs a permission these days.

Sorry, I meant 'needs a permission which isn't granted'.

Pent

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


Re: [android-developers] Re: how to accept a phone call programmitically

2012-05-17 Thread saran vonteddu
Dear Pent,

  Now I'm able to accept the call programmatically without user
interaction.
We can do dat in two ways.

One way by implementing ITelephony.aidl.

Use the below code in the same package as specified and save as *
ITelephony.aidl*
*
*
package com.android.internal.telephony;

interface ITelephony {

boolean endCall();

void answerRingingCall();

void silenceRinger();
}

And use the below method to accept the call in ur code.

private void answerPhoneAidl(Context context) throws Exception {
// Set up communication with the telephony service (thanks
to Tedd's Droid Tools!)
TelephonyManager tm = (TelephonyManager) getSystemService(
TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod(getITelephony);
m.setAccessible(true);
ITelephony telephonyService;
telephonyService = (ITelephony)m.invoke(tm);

// Silence the ringer and answer the call!
telephonyService.silenceRinger();
telephonyService.answerRingingCall();
} I read this way of accepting the call is not supported in all
versions of android. I dont know for sure. The other way is just use the
below method in ur code when ever u want to accept the call.  private
voidanswerPhoneHeadsethook
(Context context) {
// Simulate a press of the headset button to pick up the
call
Intent buttonDown = new
Intent(Intent.ACTION_MEDIA_BUTTON);
buttonDown.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(
KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
context.sendOrderedBroadcast(buttonDown,
android.permission.CALL_PRIVILEGED);

// froyo and beyond trigger on buttonUp instead of
buttonDown
Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);

buttonUp.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(
KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK));
context.sendOrderedBroadcast(buttonUp,
android.permission.CALL_PRIVILEGED);
} hope this will help you, Cheers, Saran

On Thu, May 17, 2012 at 1:40 PM, Pent supp...@apps.dinglisch.net wrote:

  As far as I know that API needs a permission these days.

 Sorry, I meant 'needs a permission which isn't granted'.

 Pent

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


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

[android-developers] Re: how to accept a phone call programmitically

2012-05-16 Thread saran vonteddu
okay friends, I got it. Its working now.


regards
Saran



On Tue, May 15, 2012 at 6:10 PM, saran vonteddu saran.myw...@gmail.comwrote:

 Dear *,

  In my application I want to accept phone call without any user
 interaction. In order to achieve that I tried using iTelephony.aidl, as
 shown below.

 package com.android.internal.telephony;

   interface ITelephony {


 boolean endCall();


 void answerRingingCall();


 void silenceRinger();

  }

 And I heard we need reflection concept to achieve this, but I don't know
 how and where to implement these methods.

 I tried the below links, but could get the appropriate solution.


 http://androidsourcecode.blogspot.com/2010/10/blocking-incoming-call-android.html

 http://prasanta-paul.blogspot.in/2010/09/call-control-in-android.html

 So please help me out in this issue, any help in this regard is highly
 appreciated.



 regards,
 Saran


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