-2

I have developed an Android application using Eclipse, basically it is an application which lets the user to respond via Sms when he has declined an incoming call or there is a call hangup event. I am done with the interface, the only problem I am facing is that how to automatically evoke the application's interface after a call hangup event has occurred. Please Help me with this! Thanks in advance.

1077
  • 1

2 Answers2

0

You can register for a telephony manager broadcast receiver,

Implement an broadcast receiver,

Inside its on receive you can receive the call states as

TelephonyManager.EXTRA_STATE, which can have values of RINGING, IDLE, OFFHOOK.

AndroCoder
  • 1,669
  • 1
  • 11
  • 5
  • I have already created a java class for the broadcast receiver and it also detects incoming calls, but after the call is declined by the user the application should show up, but that's not happening. – 1077 Feb 05 '15 at 10:14
  • On call hangup event are you starting the activity again using Intents? – AndroCoder Feb 05 '15 at 10:35
  • I have already created a java class for the broadcast receiver and it also detects incoming calls, but after the call is declined by the user the application should show up, but that's not happening. @AndroCoder – 1077 Feb 05 '15 at 10:35
  • That is what I am asking, application will show up if you will start its launcher activity using intents, are you doing that – AndroCoder Feb 05 '15 at 10:38
  • Once you have received the event of Call hangup in your broadcast receiver, you can start an activity from there using the following code **startActivity(new Intent(getApplicationContext(), YourActivity.class));** – AndroCoder Feb 05 '15 at 10:40
  • I am not using the launcher activity intents. @AndroCoder – 1077 Feb 05 '15 at 10:46
  • Please use them, it will launch your application – AndroCoder Feb 05 '15 at 10:47
  • thanks a lot, sir! Can you please provide a link or a website address from where i can take help from, as i have no idea on this. @AndroCoder – 1077 Feb 05 '15 at 10:49
0

For that you need to write your own broadcast receiver which will automatically detect that your call hangup. for more details check this link.

Dhrumil Shah - dhuma1981
  • 15,166
  • 6
  • 31
  • 39
  • I have already created a java class with a broadcast receiver and it is exactly the same as in the link provided by you, it's detecting incoming calls also, but after the call has been declined the should automatically open, but that's not happening. – 1077 Feb 05 '15 at 10:10
  • my code's a bit long and is not fitting in here. @dhuma1981 – 1077 Feb 05 '15 at 10:31