java.lang.Object | ||
↳ | android.content.ContentProvider | |
↳ | com.pspdfkit.media.AssetsContentProvider |
A content provider that serves files from the app's assets.
This content provider is registered inside the app's manifest through manifest merging (you don't need to do this manually). The content provider is not exported, so it is not possible for other apps to access the assets.
The providers base URI is content://{$applicationId
{@value CONTENT_PROVIDER_AUTHORITY_SUFFIX}}. All asset paths are relative to this URI. If you would like
to serve a file videos/movie.mp4
the respective URI would be content://{$applicationId
{@value CONTENT_PROVIDER_AUTHORITY_SUFFIX}/videos/movie.mp4}.
This content provider may only serve uncompressed asset files (caused by a limitation of Android's AssetManager). If you try to access a compressed asset the content provider will throw a FileNotFoundException.
By default the aapt
tool will compress all files inside the assets/
folder of
your app before copying them to the APK. The only exception for this are files that are already
compressed like multimedia files (i.e. video and audio files).
You can disable compression for arbitrary file types by adding this to your build.gradle
script:
android {
aaptOptions {
// You can also specify other types, even a list of types.
noCompress "txt"
}
}
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AssetsContentProvider() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | delete(Uri uri, String s, String[] strings) | ||||||||||
static Uri |
getAuthority(Context context)
Returns an
Uri containing the scheme and authority of this content provider. | ||||||||||
String | getType(Uri uri) | ||||||||||
Uri | insert(Uri uri, ContentValues contentValues) | ||||||||||
boolean | onCreate() | ||||||||||
AssetFileDescriptor | openAssetFile(Uri uri, String mode) | ||||||||||
Cursor | query(Uri uri, String[] strings, String s, String[] strings1, String s1) | ||||||||||
int | update(Uri uri, ContentValues contentValues, String s, String[] strings) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |