0

The receiver is not getting registered when the button is clicked. What am I doing wrong?

private void  AppSatartConfirmationdialog() {
    AlertDialog.Builder bi=new AlertDialog.Builder(this);
    bi.setTitle(R.string.dialoga_pp_sart_conf_title);
    bi.setMessage(R.string.dialog_app_sart_conf_message);
    bi.setPositiveButton(R.string.dialog_app_sart_conf_oK, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            //Caling receiver
            IntentFilter intentFilter = new IntentFilter("Intent.action.PHONE_STATE");
            registerReceiver(mReceiver, intentFilter);

            Toast.makeText(MainActivity.this,
            R.string.dialog_app_start_toast,
            Toast.LENGTH_SHORT).show();
        }
    });
Kara
  • 6,115
  • 16
  • 50
  • 57
CNB
  • 275
  • 1
  • 3
  • 6
  • Please fix line `IntentFilter intentFilter = new IntentFilter("Intent.action.PHONE_STATE");`. There is no such intent filter unless you have made up new one by yourself. – ozbek May 20 '13 at 10:19
  • SO what would be the filter should use for catch incoming and out going calls?? – CNB May 22 '13 at 02:34
  • See http://stackoverflow.com/questions/7121508/android-taking-complete-control-of-phone-is-it-possible-how/7121586#7121586 – ozbek May 22 '13 at 02:45
  • Also, this looks promising: http://stackoverflow.com/questions/9904426/how-to-block-a-mobile-number-call-and-message-receiving-in-android-application-d/9904826#9904826 – ozbek May 22 '13 at 02:46

0 Answers0