In this video we will learn, how to request a dangerous READ_EXTERNAL_STORAGE permission at run time, which is necessary since Android 6.0 (Marshmallow), whereas before this permission would be granted at the installation process. For this we will use the checkSelfPermission and requestPermissions methods and show a rationale to the user at the appropriate time with the shouldShowRequestPermissionRationale method.
Source code:
____________________
❗ Subscribe to the channel:
⏯ Watch more tutorials:
㊙ Help translating the videos:
💚 Support the content:
💬 Join the Discord chat:
🎧 Audiobooks and podcasts for programmers:
👶 How to get started with Android development:
📣 Follow Coding in Flow on social media:
Facebook:
Instagram:
Twitter:
Blog:
Nguồn: https://rmacct.org/
Xem thêm bài viết khác: https://rmacct.org/cong-nghe/
Xem thêm Bài Viết:
- Tổng hợp cách hướng dẫn cách kiểm tra nhiệt độ của MacBook
- Linh kiện “đáng gờm” xe máy điện VinFast Klara S 2022 thế hệ mới
- Đánh giá nhanh bo mạch chủ ASROCK X470 TAICHI ULTIMATE
- Cách tắt ứng dụng chạy ngầm android samsung, oppo, xiaomi, realme
- Không thể phá khối EXPLODE được Block trong autocad // Lệnh X (xplode) // Mẹo vặt autocad
I love your tutorials! You show and explain everything in a clear and easy to understand manner. Your tutorials have helped me so many times. Thanks!
Legendddddd ❤️. I have followed so many of your videos and they all workkkk ❤️❤️❤️
Bhai . Mera nhi log in nhi ho rha kuch idea Dona . Plzzz
private void isPermissionGranted(){
if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)==PackageManager.PERMISSION_GRANTED){
Toast.makeText(getContext(), "PERMISSION GRANTED", Toast.LENGTH_SHORT).show();
} else {
requestStoragePermission();
}
}
void requestStoragePermission(){
if(shouldShowRequestPermissionRationale(Manifest.permission.READ_EXTERNAL_STORAGE)){
new AlertDialog.Builder(getContext())
.setTitle("Permission needed")
.setMessage("This permission is needed because of")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
requestPermissions(new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSIONS_CODE);
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).create().show();
} else {
requestPermissions(new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSIONS_CODE);
}
}
Can I show alert dialog here,after user click on don't ask again and deny also, share the code please, it would be very helpful to me
Sir, will my audio record work with permission granted only I'm manifest file?
Is this runtime permission necesery if you want to put your app on google play store?
Pls don't stop your awesome work….! You are the best and beast :)))
IT WAS SO PRECISE. THANK YOU SO MUCH♥ You are a hope to we Juniors
Sir.. android.permission. is not poping out in suggestion box
Thanks this video helped me a lot. Do keep up the good work .
Thanks A lot Very Helpful. What if i want to request Permissions when the user launches the application?
hi bro can you make video how to make app run always in background
Thanks, guy! Its really work! I miss 3 days for solve this problem, but you video had helped me! Like!
You've saved my life not only once!!!
Works on Android studio but not in real device ?
And can you please tell why am i not getting JSON data from web in my real device but I get it on Android studio?
/storage/emulated/0/Download/2020-03-30 19:32:03.pdf: open failed: EACCES (Permission denied)
What this error means and how to solve it.
Thank you thank you!
Web view geolocation permission dialog not showing. Please write your code
This guy is a living legend
Nice…..
Hello Sir,
I can't share videos ,photos
Version >= Nougat
hi,how can i access these photos?
Would you please do a video on how to delete a sent SMS from inside your app, also how to grant permissions for apps that have multiple activities which require permissions. Thanks in advance….great video!
is it possible to achieve this with "extends Activity" instead of "extends AppCompatActivity"?
Brilliance, respect .