Created
May 25, 2018 04:03
-
-
Save tuttelikz/e4776a57c4063b366069ae750768aebc to your computer and use it in GitHub Desktop.
The following lines show which permissions to define for resolving some of the errors in Android.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Solves this mentioned error: | |
// android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData() | |
// Inside Manifest, define following permissions: | |
<uses-permission android:name="android.permission.CAMERA" /> | |
<uses-permission android:name="android.permission.INTERNET"/> | |
<uses-permission android:name="android.permission.RECORD_AUDIO" /> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |
// Inside onCreate method of Activity: | |
// Disable the detection of everything. | |
verifyStoragePermissions(this); | |
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); | |
StrictMode.setThreadPolicy(policy); | |
// Creates StrictMode.VmPolicy instances. | |
// For example, detect everything and log anything that's found: | |
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); | |
StrictMode.setVmPolicy(builder.build()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment