Android API below 19 equivalents for ContentResolver takePersistableUriPermission

I use this so that the user can select the file, after the selection I save only the file URI in general privileges. In the future, the user may open this file. Therefore, I have a URI, and therefore it can be done

final Intent intent = new Intent(); if (Integer.valueOf(android.os.Build.VERSION.SDK_INT) >= 19) { intent.setAction(Intent.ACTION_OPEN_DOCUMENT); } else { intent.setAction(Intent.ACTION_GET_CONTENT); } intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("application/msword,application/pdf,text/plain"); //Text, DOC, PDF startActivityForResult(intent, READ_REQUEST_CODE); protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) { //Get and Store the URI in shared prefs... final int takeFlags = data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); getContentResolver().takePersistableUriPermission(uri, takeFlags); } 

The last line of code (which, if I correctly understood the preservation of read permissions for later use), works only with API 19 and higher. What is equivalent to this below API 19? In general, the question is how to get persistnet permission in API`s below 19 in this template? Thank,

+1
android android-contentresolver file-permissions permissions
May 24 '15 at 2:14
source share
1 answer

What is equivalent to this below API 19?

There is not one other than making a copy of the contents of a local file in your own application.

+1
Apr 01 '16 at 20:38 on
source share



All Articles