2

I want reject incoming call using dot42 in VS2012, this is sample my code

[Receiver(Enabled = true)]
     [IntentFilter(
        Actions = new[] { "android.intent.action.PHONE_STATE" }, 
        Categories = new[] { Intent.CATEGORY_DEFAULT }, 
        Priority=2147483647)
    ]

    public class callReceiver : broadcastReceiver
    {
public override void OnReceive(Context context, Intent intent)
    {
        String MSG_TYPE = intent.GetAction();
        if (MSG_TYPE.Equals("android.intent.action.PHONE_STATE"))
        {
            String state = intent.GetStringExtra(TelephonyManager.EXTRA_STATE);
            if (state.Equals(TelephonyManager.EXTRA_STATE_RINGING))
            {
                AbortBroadcast();
            }
        }
     }

    }
----------   
     Add Permission
        "[assembly: usesPermission(Android.Manifest.Permission.READ_PHONE_STATE)]"
        "[assembly: usesPermission(Android.Manifest.Permission.MODIFY_PHONE_STATE)]"
        "[assembly: usesPermission(Android.Manifest.Permission.CALL_PHONE)]"

----------

The code is not work. can some help?

Cheesebaron
  • 24,131
  • 15
  • 66
  • 118

0 Answers0