Hello I am deleting some items from SD card. And in lollipop first time i ask for permission and user grant permission, but now i don't want to ask every time for permission. Its very irritating and many of guys they afraid from this behavior. How can i save my permission i.e. next time i don't need to pass that Intent again and again
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
Thank you
I give you some code to example. Remember that u need check permission on Android 6.0. OnRequestPermission is method that when u have permission will be do code in grantResult, if not u can ask for permission or saying message that user not give a permission. And this method save status for permission
You can launch your intent by adding falgs.
You can use the following code to persist permission
Also once you persist permission save the uri in a sharedPreference so that you can delete files later without confirmation.