The difference between authority and scheme in an Android URI

1.8k views Asked by At

What is the difference between URI authority and URI scheme in Android? I always use scheme in URI to indicate database table as follow:

content://scheme

I using custom search suggestion in my application, I read document about search custom suggestion in which authority used instead of scheme to reference database as follow:

content://your.authority/opthional.suggest.path/SUGGEST_URI_PATH_QUERY

What is my.authority above? What is the difference between this and scheme?

1

There are 1 answers

2
CommonsWare On BEST ANSWER

i always use scheme in uri to indicate database table as follow content://scheme

scheme is not the scheme. content is the scheme, following the rules for URI values. What you have as scheme is what in an Android content:// Uri is referred to as the authority.

what is my.authoruty above ?

It is the authority. It needs to be in android:authorities attribute for your <provider> in your manifest, and it is used by Android to find the one true ContentProvider for any Uri.

what is the difference between this and scheme ?

They are the same, because you are misusing the term "scheme".