All Projects → federicoboschini → Android-Resource-File-Provider

federicoboschini / Android-Resource-File-Provider

Licence: MIT license
A simple library to easily provide and share files from app resources

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android-Resource-File-Provider

React Native Share
Social share, sending simple data to other apps.
Stars: ✭ 2,955 (+19600%)
Mutual labels:  share, intent
ShareIntentBuilder
Share Intent Builder - Android Library for the type-safe creation of Share Intents.
Stars: ✭ 45 (+200%)
Mutual labels:  share, intent
SuperGrate
💾 Get moving with Super Grate; a free & open source Windows Profile Migration & Backup Utility. Super Grate is a GUI (Graphical User Interface) that assists Microsoft's USMT (User State Migration Utility) in performing remote migrations over a network connection.
Stars: ✭ 91 (+506.67%)
Mutual labels:  share
audio-share-discord-linux
Discord screenshare, now with audio!
Stars: ✭ 44 (+193.33%)
Mutual labels:  share
Wifi-Connect
A library project to connect two devices using Wifi-Direct
Stars: ✭ 94 (+526.67%)
Mutual labels:  share
DiagonalDrawable
🙅‍♂️ A Diagonal Drawable for backgrounds, etc.
Stars: ✭ 24 (+60%)
Mutual labels:  drawable
LocationShare
A simple Android application to share your location
Stars: ✭ 75 (+400%)
Mutual labels:  share
WormHole
WormHole allows to share classes between Flutter and Native Platform (android / ios)
Stars: ✭ 36 (+140%)
Mutual labels:  share
tss-rb
A Ruby implementation of Threshold Secret Sharing (Shamir) as defined in IETF Internet-Draft draft-mcgrew-tss-03.txt
Stars: ✭ 22 (+46.67%)
Mutual labels:  share
shared-react-components-example
An example of a mono-repository of shared React components libraries!
Stars: ✭ 85 (+466.67%)
Mutual labels:  share
tencent kit
flutter版QQ登录/分享
Stars: ✭ 201 (+1240%)
Mutual labels:  share
luis
Microsoft Luis.ai API Golang package
Stars: ✭ 29 (+93.33%)
Mutual labels:  intent
Bracer
Pass parameters safely and quickly between activities or fragments.
Stars: ✭ 57 (+280%)
Mutual labels:  intent
article
It’s Your Life. Share it. Celebrate it. Build it. AND HAVE FUN!
Stars: ✭ 33 (+120%)
Mutual labels:  share
dnglab
Camera RAW to DNG file format converter
Stars: ✭ 103 (+586.67%)
Mutual labels:  raw
Dazinator.Extensions.FileProviders
No description or website provided.
Stars: ✭ 34 (+126.67%)
Mutual labels:  fileprovider
tcloud-heroku
File sharing and torrent downloading
Stars: ✭ 24 (+60%)
Mutual labels:  share
UserFileSystemSamples
IT Hit User File System Engine samples in .NET/C#. Samples implement Virtual File System for Windows and Mac with synchronization support, on-demand loading, offline files, and Windows File Manager integration.
Stars: ✭ 60 (+300%)
Mutual labels:  fileprovider
ViewColorGenerator
A library to generate color palette for view, imageview and image from URL.
Stars: ✭ 29 (+93.33%)
Mutual labels:  drawable
SocialSDK
iOS 实现sina(新浪)、wechat(微信)、qq(腾讯) 登录、分享功能,Share,ShareSDK,高仿友盟SocialSDK UI 实现,可自定义UI实现
Stars: ✭ 64 (+326.67%)
Mutual labels:  share

Android Resource File Provider

API license Android Arsenal Build Status

Easily share audio, video, image and document files from raw, assets and drawable folders without any specific permission.

Installation

Include the dependency in your app build.gradle file:

implementation 'it.federicoboschini:resource-file-provider:1.0.0'

If you are experiencing any issue with resource merging or support-library compatibility add the dependency excluding com.android.support:

implementation('it.federicoboschini:resource-file-provider:1.0.0') {
    exclude group: 'com.android.support'
}

Configuration

Add this to your app AndroidManifest.xml:

<application>
<!--    ...     -->
    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="@string/rfp_provider_authority"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_provider_paths" />
    </provider>
<!--    ...     -->
</application>

Optional Add this (provider authority) to your app strings.xml:

<resources>
    <!--    ...     -->
    <string name="rfp_provider_authority">it.my_company.my_app.my_authority</string>
    <!--    ...     -->
</resources>

Optional Define custom file paths by creating a file_provider_paths in res/xml:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <!-- Define the desired file paths -->
    
    <!--    The default is:     -->
    <!-- <files-path name="all" path="/"/> -->
</paths>

Example: share a mp3 file

try {
    ResourceFileProvider.Builder
        .from(this)
        .setDirectory(FOLDER_RAW)
        .setFileName("my_sound")
        .setFileExtension("mp3")
        .setFileType(TYPE_AUDIO)
        .build()
        .shareFile();
} catch (FileNotFoundException e) {
    e.printStackTrace();
}

Note: setFileName parameter is without the extension.

Current supported and tested extensions:

  • .mp3
  • .jpg
  • .png
  • .pdf
  • .mp4

Current supported and tested folders:

  • drawable
  • raw
  • assets

Note: if your project contains density-dependent drawables, the nearest to the device density will be selected.

Known issues:

  • Can't get images from mipmap folder.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].