I have mistake my code. when I enter "1234", code is running but I enter another number e.g. "2525" stopped my application.
String phoneNumber = getResultData();
if (phoneNumber == null) {
phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
}
if(phoneNumber.equals("1234")){ // DialedNumber checking.
setResultData(null);
Intent i=new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setAction(Intent.ACTION_MAIN);
context.startActivity(i);
} else {
phoneNumber = getResultData();
}
I found my true code.
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL))
I added this code and good run. thanks for helps