1
salam
是否有可能獲得驗證用戶訪問的所有頻道?
我想告訴用戶文檔的渠道Android Couchbase Lite獲取所有頻道
salam
是否有可能獲得驗證用戶訪問的所有頻道?
我想告訴用戶文檔的渠道Android Couchbase Lite獲取所有頻道
加「通道」 peroperty在文件類別,然後:
com.couchbase.lite.View channelView = _database.getView("channels");
channelView.setMap(new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
ArrayList<String> channel = (List) document.get("channel");
String name = (String) document.get("ch_name");
emitter.emit(channel, name);
}
}, "2");
private void startLiveQuery(com.couchbase.lite.View view) throws Exception {
if (_liveQuery == null) {
_liveQuery = view.createQuery().toLiveQuery();
_liveQuery.addChangeListener(new LiveQuery.ChangeListener() {
public void changed(final LiveQuery.ChangeEvent event) {
new Thread(new Runnable() {
@Override
public void run() {
for (final Iterator<QueryRow> it = event.getRows(); it.hasNext();) {
QueryRow query = it.next();
_channel = (String) query.getKey();
_name = (String) query.getValue();
}
}
}).start();
}
});
_liveQuery.start();
}
}
你可以改寫你的問題 – PDStat
@PaulStatham好? – sadegh