简体   繁体   English

我在哪里找到了 React Native Expo 文件中的 AndroidManifest.xml 文件?

[英]Where did i find AndroidManifest.xml file in React Native Expo file?

Where did i find AndroidManifest.xml file in React Native Expo file for requesting permissions?我在哪里找到了用于请求权限的 React Native Expo 文件中的AndroidManifest.xml文件?

There is any other ways to request permission from user?还有其他方法可以向用户请求权限吗?

add permissions array inside your app.json like this像这样在你的app.json添加permissions数组

{
  "expo": {
    "name": "Page",

   ...

    "ios": {
      "supportsTablet": false
    },
    "android":{
      "permissions":["READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE"],
      "package":"com.example.app"
    }
  }
}

So your app.json should be所以你的 app.json 应该是

    "android":{
      "permissions":["READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE"],
      "package":"com.example.app"
    }

Basically, EXPO is a tool and provides tools to create a React-native app, When you create an app using EXPO there is no android/ios folder/project inside the react-native expo project if you need to add permissions in Android/iOS just update/Change you app.json / app.config.js Basically, EXPO is a tool and provides tools to create a React-native app, When you create an app using EXPO there is no android/ios folder/project inside the react-native expo project if you need to add permissions in Android/iOS just update/Change你app.json / app.config.js

update your app.config.js to look like更新你的app.config.js看起来像

export default {
  expo: {

    android: {
  
      permissions: ["ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION"],
      config: {
        googleMaps: {
          apiKey: "...abc...",
        },
      },
    }
  },
};

You also check this official site for more info regarding this您还可以查看此官方网站以获取有关此的更多信息
https://docs.expo.dev/versions/latest/config/app/#permissions https://docs.expo.dev/versions/latest/config/app/#permissions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM