Android Question Application to answer the phone call

systems1

Member
Licensed User
Longtime User
Hello

Is it possible to answer a phone call [incoming call] using PhoneStateChanged event. Any examples or threads related to this topic

Thanks in advance
 

mangojack

Expert
Licensed User
Longtime User
Here is a small app that does this .. It starts a service that listens for incoming calls. if a condition is met it answers the call.

it requires the Answer Call Library

I have made some changes and have not tested it but it should be ok..

Cheers mj
 

Attachments

  • AutoAnswerExample.zip
    51.2 KB · Views: 416
Last edited:
Upvote 0

systems1

Member
Licensed User
Longtime User
Hello mangojack,
Thanks for your reply. But i got this below error when i tried to run your app. Where do i find MyFirstLib library...?

Parsing code. Error
Error parsing program.
Error description: Unknown type: myfirstlib
Are you missing a library reference?
Occurred on line: 74
Dim MFL As MyFirstLib


Thank you
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Sorry ... try this one

Cheers mj
 

Attachments

  • AutoAnswerExample.zip
    51 KB · Views: 328
Upvote 0

systems1

Member
Licensed User
Longtime User
Hello MAngojack

I again got this error. Is it running properly in your device...?

Parsing code. 0.00
Compiling code. Error
Error compiling program.
Error description: Missing parameter.
Occurred on line: 21
sNotif.SetInfo("Auto Answer Call Test",Main)
Word: )
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Uploaded bad Zip .. the above one is correct ...
Change that line to

sNotif.SetInfo("Auto Answer Call" , "brief Discription ..",Main)

Cheers mj
 
Upvote 0

systems1

Member
Licensed User
Longtime User
Hello mangojack,

The error is cleared. It's compliling now. I turned Service state ... ON and it shows HangUp service started ...
But nothing is happening during incoming call. I mean app cant recieve the call

anyways let me check your code once

thank you
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
You might have the bad zip ?

B4X:
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
   
  Select State   
     'Case "IDLE" ' Idle state.
     
  Case "RINGING" ' Ringing state.
             
       ' only auto answer this number  ..... rem to answer all calls       
       'If IncomingNumber = "555123456789"  Then
         
         AC.AnswerPhone
   
         'End If
       
  End Select

End Sub

Cheers mj
 
Upvote 0

systems1

Member
Licensed User
Longtime User
Hello mangojack

I changed as how you told above. No change. It's still the same. It's not working here.

Thank you
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
hmm ?? this zip has just been tested and works

have you tried the example that came with the AnswerCall library .. maybe implement timer as in example ?

Cheers mj
 

Attachments

  • AutoAnswerExample.zip
    51 KB · Views: 365
Upvote 0

systems1

Member
Licensed User
Longtime User
Hello mangojack,
No both are not working in my device. I am using HTC One V with android 4.0.3. Any compatibility with the device i am using..?

Thanks
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Do not know what the problem could be .. maybe one of the Gurus can help ..

Cheers mj
 
Upvote 0

systems1

Member
Licensed User
Longtime User
Hello

I am repeating this question.
Is it possible to answer a phone call [incoming call] using PhoneStateChanged event. Any examples or threads related to this topic

The above example given by mangojack using Answer Call Library is not working in my HTC One V device. Any other solution from anyone here....?

Thanks in advance
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Try logging the state and incoming number in the PE_PhoneStateChanged sub, then call the device and see what it logs in the IDE.

B4X:
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
   log("State = " & State)
   log("IncomingNumber = " & IncomingNumber)
End Sub
 
Upvote 0
Top