1

In my React Native app, I need to open a WebView redirecting to my NextJS application. Its a simple page rendering a FaceDetection component from Amazon Amplify UI. The "problem" (which I know is a safety feature) is everytime I open the webview on my phone, it asks if I allow the app to use the camera. Is there a way to "save" this setting? Allow once, and never again?

The Nextjs URL is HTTPS btw

Here is the component being rendered

 const webViewProps = {
    ref: webViewRef,
    source: { uri: WEBVIEW_URL },
    scrollEnabled: false,
    showsHorizontalScrollIndicator: false,
    showsVerticalScrollIndicator: false,
    bounces: false,
    onMessage: handleWebViewMessage,
    javaScriptEnabled: true,
    domStorageEnabled: true,
    startInLoadingState: true,
    scalesPageToFit: true,
    allowsInlineMediaPlayback: true,
    mediaPlaybackRequiresUserAction: false,
    allowsCamera: true,
    allowsMicrophone: true,
    allowsLinkPreview: false,

    cacheEnabled: true,
    incognito: false,
    thirdPartyCookiesEnabled: true,
    sharedCookiesEnabled: true,

    allowsLocalNetworking: true,
    allowsBackForwardNavigationGestures: false,

    userAgent: "MyApp-WebView/1.0 (iOS/Android)",

    onLoadStart: () => setIsLoading(true),
    onLoadEnd: () => setIsLoading(false),
  };
  return <WebView {...webViewProps} style={{ flex: 1 }} />;
1
  • Ask the permissions with PermissionsAndroid beforehand and see if that is stored. Commented Jul 2 at 7:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.