如何筛选进来的电话(黑名单) - 无反射反射、黑名单、电话

由网友(还没说再见)分享简介:我在想,如果有,我可以过滤在Android(块)来电(考虑2.1及更高版本)的方式。我发现使用反射解决方案,但它似乎不是非常干净和可靠的解决方案。是否有任何标准或谷歌推荐的方式做到这一点?I was wondering if there is a way that I can filter (block) incom...

我在想,如果有,我可以过滤在Android(块)来电(考虑2.1及更高版本)的方式。我发现使用反射解决方案,但它似乎不是非常干净和可靠的解决方案。是否有任何标准或谷歌推荐的方式做到这一点?

I was wondering if there is a way that I can filter (block) incoming calls on Android (consider 2.1 and up). I found solutions using reflection, but it seem not to be very clean and reliable solution. Is there any standard or google recommended way to do that?

更新:任何

推荐答案

使用下面的广播接收器来获取来电号码,并将其与在你创建的过滤器列表中的号码比较

use the following broadcast receiver to get the incoming phone number and compare it with the numbers that are in your created filter list

@Override
public void onReceive(Context context, Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras != null) {
        String state = extras.getString(TelephonyManager.EXTRA_STATE);
        Log.w("DEBUG", state);
        if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
            String phoneNumber = extras
                    .getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
            Toast.makeText(context, phoneNumber, 2000).show();
            Log.w("DEBUG", phoneNumber);
        }
    }
}

希望这会有所帮助。您需要通过应用程序的用户界面来创建数字的黑名单列表。

Hope it will help. You need to create a list of numbers in blacklist by your application's User interface.

阅读全文

相关推荐

最新文章