Search code examples
androidandroid-file

Android: the exact location of content:\\


I'm looking for the path mentioned as below:

private static final String STOCK_BOOKMARKS_CONTENT = "content://browser/bookmarks";
private static final String CHROME_BOOKMARKS_CONTENT = "content://com.android.chrome.browser/bookmarks";

Where is the exact physical location of these paths on my Android mobile phone?


Solution

  • Content URIs are not (necessarily) file system paths. They are a representation defined by the content providers to serve data to whoever requests it without revealing the actual source of data, in a way.

    The Content URI's are generally in the following form :

    content://authority/path/id

    Where

    content - the first part (here content) is the scheme of the URI. It could be anything like file for File Uri's.

    authority - The name of the content provider , i.e. the content provider uses this part to identify content uri's meant for them and not for some other content provider.

    path & id - these are defined by the content providers to (generally) identify the exact location of data in their data store (local database, some rest api etc)

    Interestingly, Content providers provide a way to get a hold of an InputStream for the content represented by a ContentURI - using getContentResolver().openInputStream(uri)

    Related