Gmail Public Labels API は selection が使えない
The Gmail Public Labels API は、ただの ContentProvider なんだけど、query() するときに第3引数の selection が使えないので注意!
この API を使ってる他のソースをぐぐってみると、Google が作ってるソースが見つかって、(このリンクはいつまで使えるのだろうか?)
private Cursor openLabelsCursor(String account) {
try {
return getContentResolver().query(
GmailContract.Labels.getLabelsUri(account),
LabelsQuery.PROJECTION,
null, // NOTE: the Labels API doesn't allow selections here
null,
null);
} catch (SQLException e) {
// From developer console: "SQLiteException: no such table: labels"
LOGE(TAG, "Error opening Gmail labels", e);
return null;
}
}
と、"NOTE: the Labels API doesn't allow selections here" と書かれてるのでした。
当然、第4引数の selectionArgs を使って指定してみても使えない。
普通に ContentProvider として公開するなら、selection まで実装してくれよ。30分ぐらいハマったよ。。
| 固定リンク
| コメント (0)
| トラックバック (0)
最近のコメント