2013-10-03 25 views
0

請注意,因爲我來自丹麥,所以使用數字前綴+45作爲示例。來自短信和數據庫的電話號碼匹配

作爲應用程序的一部分,我有一個包含黑名單電話號碼的數據庫表。但是我的聯繫人下的一些數字存儲爲+45 xx xx xx xx,其他數字存儲爲+ 45xxxxxxxx,而其他數字則存儲爲xx xx xx xx。

傳入文本以數字格式+ 45xxxxxxxx到達。

我創建了一個簡單的提供程序,我查詢如下所示。

private boolean isBlacklisted(String phoneNumber) 
{ 
    Cursor cursor = context.getContentResolver().query(Provider.URI_BLACKLIST, 
     new String[] { Blacklist.COL_PHONE_NUMBER }, 
     Blacklist.COL_PHONE_NUMBER + " = ?", 
     new String[] { phoneNumber }, 
     null); 
    return(cursor.getCount() > 0); 
} 

你們建議做什麼適當的匹配?考慮國際標準。

回答

相關問題