如何以编程方式在Opera和Mozilla浏览器中访问android书签? [英] How do I programmatically access bookmarks in Opera and Mozilla browsers for android?
问题描述
private final Uri CHROME_URI = Uri.parse( 内容://com.android.chrome.browser/bookmarks);
private final Uri MOZILLA_URI = Uri.parse(content://org.mozilla.firefox.db.browser/bookmarks);
private private Uri OPERA_URI =?;
我设法找到chrome的书签uri,我还没有测试过uz的书签,但似乎不管怎样,只要歌剧我没有找到任何东西。
对它有什么想法?
更新:
我使用以下代码:
private final Uri MOZILLA_URI = Uri.parse(content://org.mozilla.firefox.db.browser/bookmarks);
private final String MOZILLA_PACKAGE =org.mozilla.firefox;
grantUriPermission(MOZILLA_PACKAGE,MOZILLA_URI,Intent.FLAG_GRANT_READ_URI_PERMISSION);
但是我得到:
java。 lang.SecurityException:Permission Denial:阅读org.mozilla.firefox.db.BrowserProvider uri content://org.mozilla.firefox.db.browser/bookmarks from pid = 3222,uid = 10094 requires org.mozilla.firefox.permissions。 BROWSER_PROVIDER或grantUriPermission()
尽管我通过grantUriPermission()请求了许可。
是的你是对的,它会给Firefox这个权限声明SecurityException,即org.mozilla.firefox.permissions.BROWSER_PROVIDER被声明为具有签名保护级别,并且系统不会将这个权限授予你的应用程序,因为你的应用程序的签名不同于Firefox签名。
From what I read, I need the bookmarks URI from each browser:
private final Uri CHROME_URI = Uri.parse("content://com.android.chrome.browser/bookmarks");
private final Uri MOZILLA_URI = Uri.parse("content://org.mozilla.firefox.db.browser/bookmarks");
private final Uri OPERA_URI = ?;
I managed to find chrome's bookmarks uri, I have not tested mozilla's bookmarks uri yet, but that seems to be it and as far as opera I did not find anything.
Any thoughts on what it might be?
UPDATE:
I'm using this code:
private final Uri MOZILLA_URI = Uri.parse("content://org.mozilla.firefox.db.browser/bookmarks");
private final String MOZILLA_PACKAGE = "org.mozilla.firefox";
grantUriPermission(MOZILLA_PACKAGE, MOZILLA_URI, Intent.FLAG_GRANT_READ_URI_PERMISSION);
But I get:
java.lang.SecurityException: Permission Denial: reading org.mozilla.firefox.db.BrowserProvider uri content://org.mozilla.firefox.db.browser/bookmarks from pid=3222, uid=10094 requires org.mozilla.firefox.permissions.BROWSER_PROVIDER, or grantUriPermission()
although I requested permission with grantUriPermission().
Yes you are right, it will give SecurityException as in manifest of Firefox this permission i.e. org.mozilla.firefox.permissions.BROWSER_PROVIDER is declared with signature protection level, and system will not grant this permission to your application since your application's signature is different from that Firefox signature.
这篇关于如何以编程方式在Opera和Mozilla浏览器中访问android书签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!