Android的onChange事件在contentObserver不触发在Android 5(Lollypop)铬历史 [英] Android onChange event not triggered in contentObserver for chrome history on android 5 (Lollypop)

查看:2181
本文介绍了Android的onChange事件在contentObserver不触发在Android 5(Lollypop)铬历史的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现我的contentObservers镀铬的历史记录和书签不会在Android棒棒糖了触发。在code完美的作品在旧版本的Andr​​oid(无论镀铬版),但对lollypop它不工作了。

我已经提交的铬的一个错误,这是由他人评价证实。 <一href="https://$c$c.google.com/p/chromium/issues/detail?q=obogzch%40gmail.com&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=435541&thanks=435541&ts=1416575883" rel="nofollow">https://$c$c.google.com/p/chromium/issues/detail?q=obogzch%40gmail.com&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=435541&thanks=435541&ts=1416575883

有没有人找到了一个解决办法?

LE: 感谢Fuong李某的解决方法,后添加内容观察员跳调用此方法启动:

 私人布尔checkContentProvider(URI URI)// URI =内容://com.android.chrome.browser/history

   {
        光标mCur = getContentResolver()查询(URI,NULL,NULL,NULL,NULL);
        返回(mCur.getCount()0);
   }
 

解决方案

当我更换新的URI Chrome书签从内容://com.android.chrome.browser/bookmarks,以新的URI的内容:// COM .android.chrome.browser /史,同样的问题上的棒棒糖版本不会触发onChange事件。而且,我试图查询数据,以检查观察者注册后...它运行就像一个魔术。我不知道为什么它运行正常,希望它能帮助。

I've noticed that my contentObservers for chrome history and bookmarks do not trigger anymore on android lolipop. The code works perfectly on older versions of android (regardless of the chrome version) but on lollypop it is not working anymore.

I've filed a bug on chromium and this is confirmed by others in the comments. https://code.google.com/p/chromium/issues/detail?q=obogzch%40gmail.com&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=435541&thanks=435541&ts=1416575883

Did anybody found a solution to this?

LE: Thanks Fuong Lee for the workaround, call this method after you add the content observer to jump start it:

private boolean checkContentProvider(Uri uri) //uri = content://com.android.chrome.browser/history

   {
        Cursor mCur = getContentResolver().query(uri, null, null, null, null);
        return (mCur.getCount() > 0);
   }

解决方案

When I change new URI for chrome bookmarks from "content://com.android.chrome.browser/bookmarks" to new URI "content://com.android.chrome.browser/history", the same issue "onChange event not triggered on Lolipop version". And, I try query data to check after observer registered... it running like a magic. I don't know why it running correctly, hope it help.

这篇关于Android的onChange事件在contentObserver不触发在Android 5(Lollypop)铬历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆