dot42拒绝来电

时间:2014-01-14 05:21:29

标签: c# .net dot42

我想在VS2012中使用dot42拒绝来电, 这是我的代码示例

[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)]"

----------

代码不起作用。能有所帮助吗?

0 个答案:

没有答案