Android清单XML提供程序标签. android:authorities
作者:互联网
当我在清单XML文件中遇到此标记时,我正在浏览android-17的NotePad示例应用程序:
<provider android:name="NotePadProvider"
android:authorities="com.google.provider.NotePad"
android:exported="false">
<grant-uri-permission android:pathPattern=".*" />
</provider>
我查了一下单位名称,然后看到com.google.provider.NotePad被列为提供商的授权之一.我假设NotePadProvider引用了NotePadProvider.java文件中定义的NotePadProvider类,但是我想问一问是否确实如此,以确保我走在正确的轨道上.
另外,我想知道com.google.provider.NotePad到底是什么,它的定义是什么,以及com.google.provider.NotePad的目的是什么,以及com.google.provider.NotePad是该网站的授权机构.提供商.
解决方法:
Content providers are one of the primary building blocks of Android
applications, providing content to applications. They encapsulate data
and provide it to applications through the single ContentResolver
interface. A content provider is only required if you need to share
data between multiple applications. For example, the contacts data is
used by multiple applications and must be stored in a content
provider. If you don’t need to share data amongst multiple
applications you can use a database directly via SQLiteDatabase.
实际上,com.google.provider.NotePad是实现ContentProvider的类.
从<provider>
开始:
android:authorities
A list of one or more URI authorities that
identify data offered by the content provider. Multiple authorities
are listed by separating their names with a semicolon. To avoid
conflicts, authority names should use a Java-style naming convention
(such as com.example.provider.cartoonprovider). Typically, it’s the
name of the ContentProvider subclass that implements the provider
标签:provider,manifest,authority,android 来源: https://codeday.me/bug/20191123/2065980.html