How to launch an application on android home screen on incoming call

  • Replies:0
Prachi Mishra
  • Forum posts: 1

Feb 25, 2011, 5:26:22 AM via Website

I have developed one application and got stuck into how can i launch my custom application when android phone rings.
I want to display my own application alongwith Accept/Reject options coming on incoming call on android ..
In one of the existing application 'PhonePlusCallBack' developers are doing the same thing.
I am able to track the phonestate with Broadcast Receiver code looks like this

public class ServiceReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

Bundle bundle = intent.getExtras();

String state = bundle.getString(TelephonyManager.EXTRA_STATE);

if(state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))
{
String phonenumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);

final Intent newIntent = new Intent(context, GreetAppLauncher.class);
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(newIntent);
}

Here i am starting new activity on incoming call But the application is not displayed on homescreen.

Kindly tell me the solution asap
Thanks in advance

— modified on Feb 25, 2011, 5:32:03 AM

Reply