<i id='BpINy'><tr id='BpINy'><dt id='BpINy'><q id='BpINy'><span id='BpINy'><b id='BpINy'><form id='BpINy'><ins id='BpINy'></ins><ul id='BpINy'></ul><sub id='BpINy'></sub></form><legend id='BpINy'></legend><bdo id='BpINy'><pre id='BpINy'><center id='BpINy'></center></pre></bdo></b><th id='BpINy'></th></span></q></dt></tr></i><div id='BpINy'><tfoot id='BpINy'></tfoot><dl id='BpINy'><fieldset id='BpINy'></fieldset></dl></div>

      <bdo id='BpINy'></bdo><ul id='BpINy'></ul>
      <legend id='BpINy'><style id='BpINy'><dir id='BpINy'><q id='BpINy'></q></dir></style></legend>
    1. <tfoot id='BpINy'></tfoot>

      <small id='BpINy'></small><noframes id='BpINy'>

      如何在运行时在 React Native 中请求 Android 设备位置

      时间:2023-09-02
    2. <small id='PyDKq'></small><noframes id='PyDKq'>

        <bdo id='PyDKq'></bdo><ul id='PyDKq'></ul>
          <i id='PyDKq'><tr id='PyDKq'><dt id='PyDKq'><q id='PyDKq'><span id='PyDKq'><b id='PyDKq'><form id='PyDKq'><ins id='PyDKq'></ins><ul id='PyDKq'></ul><sub id='PyDKq'></sub></form><legend id='PyDKq'></legend><bdo id='PyDKq'><pre id='PyDKq'><center id='PyDKq'></center></pre></bdo></b><th id='PyDKq'></th></span></q></dt></tr></i><div id='PyDKq'><tfoot id='PyDKq'></tfoot><dl id='PyDKq'><fieldset id='PyDKq'></fieldset></dl></div>
            <tbody id='PyDKq'></tbody>
              <tfoot id='PyDKq'></tfoot>

              • <legend id='PyDKq'><style id='PyDKq'><dir id='PyDKq'><q id='PyDKq'></q></dir></style></legend>
                本文介绍了如何在运行时在 React Native 中请求 Android 设备位置的权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我一直在尝试将 React Native 的 GeoLocalisation 用于 Android 应用程序.文档记录不佳的模块可在此处找到 https://facebook.github.io/react-本机/docs/geolocation.html.根据文档,您使用 AndroidManifest.xml 文件中的以下代码处理 Android 上的位置权限

                I have been trying to use React Native 's GeoLocalisation for an Android App. The poorly documentated module is found here https://facebook.github.io/react-native/docs/geolocation.html. According to the documentation, you handle location permissions on Android using the following code in the AndroidManifest.xml file

                <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
                

                但是,我的在线研究表明,上述代码行对于 ANDROID >= 6.0

                However, my online research suggests that the above line of code is useless for versions of ANDROID >= 6.0

                由于我的 GeoLocation 实现当前无法正常工作,我没有其他理由相信位置权限没有得到正确处理.

                As my implementation of GeoLocation is not currently working, I have no other reason but to believe that location permissions are not correctly handled.

                如何在运行时为 React Native Android App 成功请求位置权限?提前致谢!

                How do I successfully request location permission at run-time for React Native Android App ? Thanks in advance !

                推荐答案

                这对我不起作用

                if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                }
                

                我提到了 https://facebook.github.io/react-native/docs/permissionsandroid.html#request并且 check() 返回一个布尔值

                I referred to https://facebook.github.io/react-native/docs/permissionsandroid.html#request and check() return a boolean

                const granted = await PermissionsAndroid.check( PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION );
                
                if (granted) {
                  console.log( "You can use the ACCESS_FINE_LOCATION" )
                } 
                else {
                  console.log( "ACCESS_FINE_LOCATION permission denied" )
                }
                

                这篇关于如何在运行时在 React Native 中请求 Android 设备位置的权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:LocationClient 与 LocationManager 下一篇:Android 导入com.google 无法解决

                相关文章

                最新文章

                • <bdo id='5rfis'></bdo><ul id='5rfis'></ul>
                <tfoot id='5rfis'></tfoot>

                1. <legend id='5rfis'><style id='5rfis'><dir id='5rfis'><q id='5rfis'></q></dir></style></legend>

                    <small id='5rfis'></small><noframes id='5rfis'>

                    <i id='5rfis'><tr id='5rfis'><dt id='5rfis'><q id='5rfis'><span id='5rfis'><b id='5rfis'><form id='5rfis'><ins id='5rfis'></ins><ul id='5rfis'></ul><sub id='5rfis'></sub></form><legend id='5rfis'></legend><bdo id='5rfis'><pre id='5rfis'><center id='5rfis'></center></pre></bdo></b><th id='5rfis'></th></span></q></dt></tr></i><div id='5rfis'><tfoot id='5rfis'></tfoot><dl id='5rfis'><fieldset id='5rfis'></fieldset></dl></div>