I’m trying to delete a bookmark using contentResolver.delete() and I get force close for missing permission “com.android.broswer.permission.WRITE_HISTORY_BOOKMARKS” but it’s in the manifest…
this is in the manifest (outside <application></application>)
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"></uses-permission>
<uses-permission android:name="com.android.broswer.permission.WRITE_HISTORY_BOOKMARKS"></uses-permission>
this is the method:
public void deleteBookmark(Cursor cur, long id) {
getContentResolver().delete(BOOKMARKS_URI, "_id = " + id, null);
}
(ignore the unused Cursor)
and this is the logcat:
E/AndroidRuntime(26750): FATAL EXCEPTION: main
E/AndroidRuntime(26750): java.lang.SecurityException: Permission Denial: writing
com.android.browser.BrowserProvider uri content://browser/bookmarks from pid=26
750, uid=10001 requires com.android.browser.permission.WRITE_HISTORY_BOOKMARKS
E/AndroidRuntime(26750): at android.os.Parcel.readException(Parcel.java:1
260)
E/AndroidRuntime(26750): at android.database.DatabaseUtils.readExceptionF
romParcel(DatabaseUtils.java:160)
E/AndroidRuntime(26750): at android.database.DatabaseUtils.readExceptionF
romParcel(DatabaseUtils.java:114)
E/AndroidRuntime(26750): at android.content.ContentProviderProxy.delete(C
ontentProviderNative.java:472)
E/AndroidRuntime(26750): at android.content.ContentResolver.delete(Conten
tResolver.java:675)
E/AndroidRuntime(26750): at com.deleteBookmark(.java:167)
E/AndroidRuntime(26750): at com.onContextItemSe
lected(.java:138)
E/AndroidRuntime(26750): at android.app.Activity.onMenuItemSelected(Activ
ity.java:2199)
E/AndroidRuntime(26750): at com.android.internal.policy.impl.PhoneWindow$
ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2744)
E/AndroidRuntime(26750): at com.android.internal.view.menu.MenuItemImpl.i
nvoke(MenuItemImpl.java:143)
E/AndroidRuntime(26750): at com.android.internal.view.menu.MenuBuilder.pe
rformItemAction(MenuBuilder.java:855)
E/AndroidRuntime(26750): at com.android.internal.view.menu.MenuDialogHelp
er.onClick(MenuDialogHelper.java:137)
E/AndroidRuntime(26750): at com.android.internal.app.AlertController$Aler
tParams$3.onItemClick(AlertController.java:875)
E/AndroidRuntime(26750): at android.widget.AdapterView.performItemClick(A
dapterView.java:284)
E/AndroidRuntime(26750): at android.widget.ListView.performItemClick(List
View.java:3382)
E/AndroidRuntime(26750): at android.widget.AbsListView$PerformClick.run(A
bsListView.java:1696)
E/AndroidRuntime(26750): at android.os.Handler.handleCallback(Handler.jav
a:587)
E/AndroidRuntime(26750): at android.os.Handler.dispatchMessage(Handler.ja
va:92)
E/AndroidRuntime(26750): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(26750): at android.app.ActivityThread.main(ActivityThrea
d.java:4627)
E/AndroidRuntime(26750): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(26750): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(26750): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(26750): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:626)
E/AndroidRuntime(26750): at dalvik.system.NativeStart.main(Native Method)
Any idea why it says Permission Denial when it’s clearly in the manifest? Maybe my code is the problem?
Did you check this post
It says the following
Anything in the com.android.* package is a private API and you should not
rely on it as it could break in a future update.
Things that are public are (usually) android.* (minus the leading com.)
and are described in the SDK documentation.