以下错误会在 Pixel 设备版本号为 RQ1A.201205.003 或更高版本上发生。
我想知道这个错误的原因以及如何处理它。
这是一个错误还是规范变更?
我想知道这个错误的原因以及如何处理它。
这是一个错误还是规范变更?
■代码
ContentResolver resolver = getContentResolver();
String order = "date ASC limit 100";
Cursor cursor = resolver.query(
CallLog.Calls.CONTENT_URI,
null,
null,
null,
order);
■错误
"Invalid token limit,LINE:142,Method:readExceptionFromParcel Exception:Invalid token limit"
■出现错误的构建号
https://support.google.com/pixelphone/thread/87641266
・RQ1A.201205.003
・RQ1A.201205.008
・RQ1A.201205.011
https://support.google.com/pixelphone/thread/93232095
・RQ1A.210105.002
・RQ1A.210105.003
https://support.google.com/pixelphone/thread/96244000
・RQ1A.210205.004
■如果您使用以下代码替换,将不会出现错误。
buildUpon().appendQueryParameter("limit", "100")
■补充信息
按照官方文档的方法实现时,没有错误发生,但是LIMIT
子句不起作用(检索到了所有记录)。
// Request 20 records starting at row index 30.
Bundle queryArgs = new Bundle();
queryArgs.putInt(ContentResolver.QUERY_ARG_OFFSET, 30);
queryArgs.putInt(ContentResolver.QUERY_ARG_LIMIT, 20);
Cursor cursor = getContentResolver().query(
contentUri, // Content Uri is specific to individual content providers.
projection, // String[] describing which columns to return.
queryArgs, // Query arguments.
null); // Cancellation signal.