RuntimeException的在CallLog.CallsRuntimeException、CallLog、Calls

2023-09-08 09:37:18 作者:陪我吹吹风

我得到有时在某些设备上的RuntimeException的,如果我尝试查询 CallLog.Calls 。 我查询 CallLog.Calls 的ContentProvider 获得最后一个电话。

任何人可以帮助我为什么收到此错误有时会? 我想,这是一个系统错误/问题?

 致:android.database.sqlite.SQLiteException:没有这样的列:sdn_alpha_id:,
在编译:SELECT sns_receiver_count,numberlabel,服务类型,matched_number,
类型,使用ContactID,lookup_uri,MIME_TYPE,sdn_alpha_id,sp_type,邮件ID,FNAME,
imnum,LNAME,sns_pkey,ACCOUNT_ID,FORMATTED_NUMBER,call_out_duration,数量,
地理coded_location,帐户名,is_read,raw_contact_id,source_data,cdnip_number,
状态,_subject,日期,real_phone_number,source_package,_id,sns_tid,名称,
normalized_number,name_reversed,_data,photo_id,LOGTYPE,reject_flag,has_content,
m_content,country_ code,频繁,cityid,BNAME,countryiso,numbertype,新,
期间,cnap_name,地址,e164_number,voicemail_uri原木WHERE
(logs.logtype = 100 OR logs.logtype = 110 OR logs.logtype = 500 OR logs.logtype = 800
logs.logtype = 900 OR logs.logtype = 1000或(logs.logtype = 200号NOT IN(SELECT
从日志数,其中数LIKE'%@%'))或logs.logtype = 300)AND((((类型!='4'))))
ORDER BY日期DESC
在android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:180)
在android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:136)
在android.content.ContentProviderProxy.query(ContentProviderNative.java:358)
在android.content.ContentResolver.query(ContentResolver.java:317)
 

我的code查询CallLog是:

  //取得callLog最后一项
光标C = context.getContentResolver()查询(Calls.CONTENT_URI,NULL,NULL,
空,Calls.DATE +降序);
 

解决方案

我和我的GS2同样的问题在更新后。我绕过它加入我需要的投影,而不是空的领域。

如:

 的String []投影=新的String [] {CallLog.Calls._ID,CallLog.Calls.CACHED_NAME,CallLog.Calls.DATE,CallLog.Calls.DURATION,CallLog.Calls。 NUMBER,CallLog.Calls.TYPE};

光标C = context.getContentResolver()查询(Calls.CONTENT_URI,投影,空,
空,Calls.DATE +降序);
 
scapy2.3.3 python2.7 windows10 . 执行文件报 NameError global name log runtime is not defined

I get sometimes on some devices an RuntimeException, if I try to query the CallLog.Calls. I query the CallLog.Calls with contentProvider to get the last call.

Can anybody help why am I getting this error sometimes? I think, this is a system bug/problem?

Caused by: android.database.sqlite.SQLiteException: no such column: sdn_alpha_id: ,
while compiling: SELECT sns_receiver_count, numberlabel, service_type, matched_number, 
type, contactid, lookup_uri, mime_type, sdn_alpha_id, sp_type, messageid, fname, 
imnum, lname, sns_pkey, account_id, formatted_number, call_out_duration, number,     
geocoded_location, account_name, is_read, raw_contact_id, source_data, cdnip_number,    
state, _subject, date, real_phone_number, source_package, _id, sns_tid, name, 
normalized_number, name_reversed, _data, photo_id, logtype, reject_flag, has_content, 
m_content, country_code, frequent, cityid, bname, countryiso, numbertype, new, 
duration, cnap_name, address, e164_number, voicemail_uri FROM logs WHERE 
(logs.logtype=100 OR logs.logtype=110 OR logs.logtype=500 OR logs.logtype=800 OR 
logs.logtype=900 OR logs.logtype=1000 OR (logs.logtype=200 AND number NOT IN (SELECT 
number FROM logs WHERE number LIKE '%@%')) OR logs.logtype=300) AND ((((type != '4')))) 
ORDER BY date DESC
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:180)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:136)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:358)
at android.content.ContentResolver.query(ContentResolver.java:317)

My code to query the CallLog is:

// get last entry in callLog
Cursor c = context.getContentResolver().query(Calls.CONTENT_URI, null, null, 
null, Calls.DATE + " DESC");

解决方案

I had the same issue with my GS2 after an update. I get around it by adding the fields I need in the projection instead of null.

eg.

String[] projection = new String[] {CallLog.Calls._ID, CallLog.Calls.CACHED_NAME, CallLog.Calls.DATE, CallLog.Calls.DURATION, CallLog.Calls.NUMBER, CallLog.Calls.TYPE };

Cursor c = context.getContentResolver().query(Calls.CONTENT_URI, projection , null, 
null, Calls.DATE + " DESC");