do i need inform or take permissions from users if i need to write or read from application app?

3.3k views Asked by At

do i need inform or take permissions from users if i need to write or read from application app ?

i need to know Officially and legally if Do I have to ask the user to grant me permissions either by ios or android

Future<String> get _localPath async {
  final directory = await getApplicationDocumentsDirectory();

  return directory.path;
}

 Future<File> get _localFile async {
  final path = await _localPath;
  return File('$path/counter.txt');
}
    // Write the file
    Future<File> writeCounter(int counter) async {
  final file = await _localFile;
  return file.writeAsString('$counter');
}
    
    // Read the file
   Future<int> readCounter() async {
  try {
    final file = await _localFile;
    final contents = await file.readAsString();
    return int.parse(contents);
  } catch (e) {
    return 0;
  }
}turn int.parse(contents);
      } catch (e) {
        return 0;
      }
    }
1

There are 1 answers

3
raghav042 On

Yes, for android you need read and write permission but for iOS only read permission required, for example:

I want to read and write permission then I will modify
info.plist file in iOS

<key>NSMicrophoneUsageDescription</key>
<string>This app require permission to access microphone</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app require permission to access gallery</string>

ask permission for whatever resources I want

AndroidMainfest.xml file in android

<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permissionandroid:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>