ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

Flutter Permission

by Little Bear @17 พ.ค. 64 14:04 ( IP : 171...238 ) | Tags : App , Flutter

iOS: in ios/Runner/Info.plist

ขอสิทธิ์ Location

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key><true/>
</dict>

ขอสิทธิ์ใช้กล้อง

<key>NSCameraUsageDescription</key>
<string>Explanation on why the camera access is needed.</string>

ขอสิทธิ์ไมโครโฟน

<key>NSMicrophoneUsageDescription</key>
<string>Flutter requires acess to microphone.</string>

Android: android/app/build.gradle

defaultConfig {
    minSdkVersion 21

Android: android/app/src/main/AndroidManifest.xml

<application>
    <provider
        android:name="com.pichillilorenzo.flutterinappwebview.InAppWebViewFileProvider"
        android:authorities="${applicationId}.flutterinappwebview.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
        android:name="android.support.FILEPROVIDERPATHS"
        android:resource="@xml/provider_paths" />
        </provider>
</application>

Create file res/values/provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths>
</paths>

main.dart

import 'package:permission_handler/permission_handler.dart';

Future main() async {
    WidgetsFlutterBinding.ensureInitialized();
    await Permission.camera.request();
    runApp(MyApp());
}

สิทธิ์อื่นดูได้จาก Enable camera for HTML inputs

ที่มา