Register another broadcast receiver which responds to call incoming state set one flag which you can check in your receiver Intent.ACTION_SCREEN_ON) if flag is already set then skip to starting activity and reset flag else start activity like
if(action.equalsIgnoreCase("android.intent.action.PHONE_STATE"))
{
if (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(
TelephonyManager.EXTRA_STATE_RINGING))
{
incomingcall = true;
}
}
and check
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)){
if(incomingcall ==true)
{
//skip the reciver and reset flag incomingcall = false;
}
else{
Intent i = new Intent(context, MainScreenActivity.class);
i.putExtras(intent);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
Log.e("receiver", "throwing in the lock screen");
}
}
for more information about ordered broadcast http://android-developers.blogspot.in/2011/01/processing-ordered-broadcasts.html