如果需要从应用程序应用程序写或阅读,我是否需要告知或获取用户的权限?
如果需要从应用程序应用程序写或阅读,我是否需要告知或获取用户的权限?
我需要正式和合法地知道我是否必须要求用户授予我iOS或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;
}
}
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,对于Android,您需要阅读和写入许可,但对于iOS,仅需要阅读权限,例如:
我想阅读和写入许可,然后我将修改
info.plist iOS中的文件
androidmainfest.xml android中的文件
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
AndroidMainfest.xml file in android