Android: exported's impact on ContentProvider,

Source: Internet
Author: User

Android: exported's impact on ContentProvider,

The following code is configured in Manifest after the ContentProvider is written in MainActivity In the tutorial video from the previous two days.

<provider    android:name="test.provider.SQLiteProvider"    android:authorities="test.provider" />

However, the content cannot be transmitted. At that time, no definite answer was found on the Internet. Some users configured a lot of content in the provider and accidentally added the android: exported = "true ", it happened to be successful, but I don't know why.

I read the SDK documentation carefully today and found the clues.

android:exportedWhether the content provider is available for other applications to use:true: The provider is available to other applications. Any application can use the provider's content URI to access it, subject to the permissions specified for the provider.false: The provider is not available to other applications. Set android:exported="false" to limit access to the provider to your applications. Only applications that have the same user ID (UID) as the provider will have access to it.The default value is "true" for applications that set either android:minSdkVersion or android:targetSdkVersion to "16" or lower. For applications that set either of these attributes to "17" or higher, the default is "false".You can set android:exported="false" and still limit access to your provider by setting permissions with the permission attribute.

The default value is "true" and "else ".

Because the teaching video is 12 years old, I use the latest version, which inevitably produces a difference. Therefore, most people now need to configure the export.

<provider    android:name="test.provider.SQLiteProvider"    android:authorities="test.provider"    android:exported="true" />

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.