AndyShubh
AndyShubh

Reputation: 43

Google Play Store Error: Not a Core Feature due to MANAGE_EXTERNAL_STORAGE Permission

I developed a PDF reading app where the home screen displays a list of PDF files from local storage. I utilized the following code in my Flutter app to manage permissions and load PDF files:

Android Manifest

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_DOCUMENTS" />

Dart code

// Permission checks and loading PDF files
Future<void> _checkPermissionAndLoadPDFFiles() async {
    // Check permission status
    _permissionStatus = await Permission.manageExternalStorage.status;
    if (_permissionStatus.isGranted) {
        await _loadPDFFiles();
    } else {
        if (await Permission.manageExternalStorage.isPermanentlyDenied) {
            _showPermissionDeniedDialog();
        } else {
            await _requestPermission();
        }
    }
}

// Request permission
Future<void> _requestPermission() async {
    final status = await Permission.manageExternalStorage.request();
    if (status.isGranted) {
        _permissionStatus = PermissionStatus.granted;
        await _loadPDFFiles();
    } else if (status.isPermanentlyDenied) {
        _showPermissionDeniedDialog();
    }
}

Issue found: Not a core feature The app feature that you declared as dependent on the All files access permission didn’t meet the policy review requirements for critical core functionality.

Core functionality is defined as the main purpose of the app. Without this core functionality, the app is "broken" or rendered unusable. The core functionality, as well as any core features that comprise this core functionality, must all be prominently documented and promoted in your app's store listing description on Google Play.

Update your app so that the feature doesn't use this permission. If your app doesn’t require access to the MANAGE_EXTERNAL_STORAGE permission, you must remove it from your app's manifest in order to successfully meet the policy review requirements.

Alternatively, if your app is “broken” or rendered unusable without this permission, it’s likely your earlier declaration was misstated or is unclear. Ensure that the core functionality and technical justification are clearly documented and promoted in the app's description when you complete the Permissions Declaration Form, and resubmit your app on the Play Console.

Additionally, follow these steps to bring your app into compliance:

Follow these steps to bring your app into compliance:

Review the All Files Access Permission policy. Read more about Use of All files access permission to better understand permitted and invalid uses. Review Android storage use cases and best practices for common storage use cases. If your app meets the requirements of permitted uses, read how to Declare permissions for your app. About the All Files Access Permission policy Files and directory attributes on a user's device are regarded as personal and sensitive user data subject to the Personal and Sensitive Information policy and the following requirements:

Apps should only request access to device storage which is critical for the app to function, and may not request access to device storage on behalf of any third-party for any purpose that is unrelated to critical user-facing app functionality. Android devices running Android "R" (Android 11) or later, will require the MANAGE_EXTERNAL_STORAGE permission in order to manage access to shared storage. All apps that target R or later and request broad access to shared storage ("All files access") must successfully pass an appropriate access review prior to publishing. Apps allowed to use this permission must clearly prompt users to enable "All files access" for their app under "Special app access" settings. For more information on the R requirements, see Use of All files access (MANAGE_EXTERNAL_STORAGE) permission.

I need assistance in finding a solution to resolve this issue so that I can successfully upload my app on the Google Play Store.

Upvotes: 0

Views: 873

Answers (1)

Dharam Budh
Dharam Budh

Reputation: 2352

In your case, such critical permission isn't necessary.

So, you could use this method instead:

Manifest file source code:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

Dart file source code:

  Future<bool> permissionPhotoOrStorage() async {
    bool perm = false;
    if (Platform.isIOS) {
      perm = await permissionPhotos();
    } else if (Platform.isAndroid) {
      final AndroidDeviceInfo android = await DeviceInfoPlugin().androidInfo;
      final int sdkInt = android.version.sdkInt ?? 0;
      perm = sdkInt > 32 ? await permissionPhotos() : await permissionStorage();
    } else {}
    return Future<bool>.value(perm);
  }

  Future<bool> permissionPhotos() async {
    bool hasPhotosPermission = false;
    final PermissionStatus try0 = await Permission.photos.status;
    if (try0 == PermissionStatus.granted) {
      hasPhotosPermission = true;
    } else {
      final PermissionStatus try1 = await Permission.photos.request();
      if (try1 == PermissionStatus.granted) {
        hasPhotosPermission = true;
      } else {}
    }
    return Future<bool>.value(hasPhotosPermission);
  }

  Future<bool> permissionStorage() async {
    bool hasStoragePermission = false;
    final PermissionStatus try0 = await Permission.storage.status;
    if (try0 == PermissionStatus.granted) {
      hasStoragePermission = true;
    } else {
      final PermissionStatus try1 = await Permission.storage.request();
      if (try1 == PermissionStatus.granted) {
        hasStoragePermission = true;
      } else {}
    }
    return Future<bool>.value(hasStoragePermission);
  }
  

Dependent package: device_info_plus

I also want to pick the document in one project. So, I wrote this code. I tested code from SDK 29 to SDK 34 & it is working incredibly. Give it a try. All you need to call is the permissionPhotoOrStorage() function.

Upvotes: 1

Related Questions