0

I am working on android app which can make missed call on other phone of particular duration like 5, 10 seconds, I am struck once call is made through a program to a particular number my program loose control, how I can end after some fixed no. of seconds after call is made, the general purpose SDK only allow to initiate call not for abortion.

I am new to android and done a deep search on net about this some folks refer using JAVA reflection and internal telephony for this but I wasn't able to do it, although I have done this on Symbian s-60 platform.

Any Suggestion?

j0k
  • 22,600
  • 28
  • 79
  • 90
Deepender Singla
  • 999
  • 9
  • 28

2 Answers2

1

use telephony.aidl interface it consist method named endCall() which is used to terminate on going call

start timer in onReceive() method of broad cast receiver when your call is in Ringing state or in off-hook state

use endCall() method in that timer

Let me know if you need more things from me

Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51
0
    import android.content.BroadcastReceiver;
     import android.content.Context;
     import android.content.Intent;
     import android.util.Log;
     import android.widget.Toast;

     public class OutgoingCallReceiver extends BroadcastReceiver {


         @Override
         public void onReceive(Context context, Intent intent) {
    if(intent.getAction().equals(Intent.NEW_OUTGOING_CALL))
     {
       abortBroadcast ();
       }
    }
      }

Requires

<uses-permission android:name="android.permission.CALL_PHONE"/>
TNR
  • 5,839
  • 3
  • 33
  • 62
  • I have made following code but it is not working , call is not aborted [link] (http://pastebin.com/JSB1tKFQ), kindly help – Deepender Singla Dec 29 '12 at 09:07
  • hey what you are implementing? BroadCast Receiver can never be called using startActivity. Just refer some examples on how raising an Receiver action. you need use sendBroadCast() to send receiver action. – TNR Dec 29 '12 at 11:21
  • sorry for doing things wrong earlier , now i have gone through broadcast receiver implemented basic code which also print outgoing number it is doing this accurately but call is not aborted, code is here [link](http://pastebin.com/xFUatNs1) – Deepender Singla Dec 30 '12 at 15:35
  • @DeependerSingla I have gone through your code. BroadCastReceiver class will respond for everything action. so it might print your log. Please just add your phone number log printing code before abortBroadcast() inside if loop. if it prints then it would be strange. If doesn't prints then you have add receiver action inside receiver tag in the AndroidManifest.xml. Hope this should work for you. – TNR Dec 31 '12 at 04:04
  • It is printing code inside loop also , i tried different approach using internaltelephony even that is not working can u give a try [link] (http://stackoverflow.com/q/14092141/793806) – Deepender Singla Dec 31 '12 at 04:21