According to these changes on Android 6.0 I am unable to compile my code as this line Browser.BOOKMARKS_URI
generates cannot resolve symbol error.
I have tried writing code like this
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M){
mCur = ctx.getContentResolver().query(Browser.BOOKMARKS_URI,
Browser.HISTORY_PROJECTION, null, null, "date DESC");
}else{
//TODO code for newer version
}
I am compiling my code with api23 but can not build project, should I lower down to api22 or is there any other way to compile this code using api23.
As of Marshmallow, you will be unable to actually use the bookmarks.
From Android issue tracker #2805:
Global bookmarks are no longer available. They haven't really done anything for a long time anyway, since browsers these days generally keep their own internal bookmarks data rather than putting them in the global provider. Apps using the global provider should likewise switch to maintaining them internally.
However, they will still work on older versions of Android, with the caveat mentioned above. To support older versions of Android while continuing to compile against API 23, you will need to hardcode the old URI.
Looking at the Lollipop source, the URI is defined as
public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
Define this in your own code and proceed as you were before, but make sure that you only use it on API 22 and below.