如何获得Android API 25(牛轧糖)的权限

时间:2022-07-09 15:29:19

want to save file on storage.

想要在存储上保存文件。

i use this code to get permission in android 6.0 :

我使用此代码获取Android 6.0的权限:

if (Build.VERSION.SDK_INT >= 23) {
            ActivityCompat.requestPermissions(Activity.this,
                    new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE},
                    1);
        }

but in android 7 seems not working. and file not saving on storage.

但在Android 7似乎无法正常工作。和文件不保存在存储上。

what different between android 6 and 7 permissions?

android 6和7权限有什么不同?

2 个解决方案

#1


1  

they are the same just that in nougat file:// are not allowed check this file:// scheme is now not allowed to be attached with Intent on targetSdkVersion 24 (Android Nougat).

它们与nougat文件中的相同://不允许检查此文件:// scheme现在不允许在targetSdkVersion 24(Android Nougat)上附加Intent。

#2


0  

I faced the same problem when creating folders and saving files with my app. It is working fine on API 18 but not directly on API 24. I figured out, that you have to allow an additional permission for the app in their settings when installed.

在使用我的应用创建文件夹和保存文件时,我遇到了同样的问题。它在API 18上正常工作,但不能直接在API 24上运行。我发现,安装后必须在其设置中允许应用程序获得额外权限。

But you may want to follow this answer: Write to external storage on Android 7

但您可能希望遵循以下答案:在Android 7上写入外部存储

#1


1  

they are the same just that in nougat file:// are not allowed check this file:// scheme is now not allowed to be attached with Intent on targetSdkVersion 24 (Android Nougat).

它们与nougat文件中的相同://不允许检查此文件:// scheme现在不允许在targetSdkVersion 24(Android Nougat)上附加Intent。

#2


0  

I faced the same problem when creating folders and saving files with my app. It is working fine on API 18 but not directly on API 24. I figured out, that you have to allow an additional permission for the app in their settings when installed.

在使用我的应用创建文件夹和保存文件时,我遇到了同样的问题。它在API 18上正常工作,但不能直接在API 24上运行。我发现,安装后必须在其设置中允许应用程序获得额外权限。

But you may want to follow this answer: Write to external storage on Android 7

但您可能希望遵循以下答案:在Android 7上写入外部存储