简体   繁体   English

Visual Studio Cordova App添加插件作为可选功能

[英]Visual Studio Cordova App add plugin as optional feature

I am having an issue in publishing my app in Google play when I include some plugins like cordova-plugin-geolocation in my app, as it adds the following 2 permissions in my manifest file 当我在应用程序中包含一些插件(例如cordova-plugin-geolocation时,在Google Play中发布应用程序时出现问题,因为它在清单文件中添加了以下2个权限

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

this causes an issue that some of the phones are not able to view the app in the google play as they tell me that android.hardware.location.network access is not compatible on those devices. 这会导致一个问题, 某些电话无法在Google Play中查看该应用 ,因为它们告诉我在这些设备上android.hardware.location.network访问不兼容。

when I researched a bit more, I can see that this can be avoided by converting uses-permission to uses-feature and setting the android:required="false" then I can handle it in my code as this is not a must have feature for me. 当我进行更多研究时,我可以看到可以通过将uses-permission转换为uses-feature并设置android:required="false"来避免,然后我可以在我的代码中处理它,因为这不是必须具备的功能为了我。

My issue is I am unable to find how to change this in my visual studio project. 我的问题是我无法在Visual Studio项目中找到如何更改此设置的方法。 can someone please help me understand whats the way to fix this? 有人可以帮我了解解决此问题的方法吗?

Regards Kiran 问候基兰

There is no way within VS to add contents to your Android projects manifest file. VS中无法将内容添加到Android项目清单文件中。 You will have to hand edit those, but beware that these changes would be over-written every time you build your project through VS. 您将不得不手动编辑这些内容,但是请注意,每次通过VS构建项目时,这些更改都会被覆盖。 There are couple of ways you can workaround this - 有几种方法可以解决此问题-

  • You can add post_build Cordova hook that would update the Manifest file. 您可以添加post_build Cordova挂钩,该挂钩将更新清单文件。
  • You can add a gulp task and hook this to MSBuild post_build event through VS. 您可以添加gulp任务,然后通过VS将其挂接到MSBuild post_build事件。

SOak (PM - Microsoft) 浸泡(PM-Microsoft)

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

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