Native Android screenshot/image sharing in Unity using FileProvider

This post was originally posted at and reposted on Medium on 28th May 2020.

1. Create a project and separate module in Native Android using Android Studio

Since putting a raw Android XML is not allowed in Unity, we need a separate Android module containing our code and export it as an aar file to use it in Unity. To create the same we need Android studio. I am not going to follow on how to download and setup android studio. You can Google it and set it up.

// ""
and//testImplementation 'junit:junit:4.12'
//androidTestImplementation ''
// ''
apply plugin: ''

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"

testInstrumentationRunner ""


buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation ''

Please continue reading at



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store