android - 没有蓝牙的蓝牙的phonegap权限

标签 android cordova bluetooth phonegap diagnostics

电话间隙

config.xml

...
<preference name="android-build-tool" value="gradle" />
...
<preference name="phonegap-version" value="cli-7.0.1" />
...
<preference name="cordova.plugins.diagnostic.modules" value="CAMERA" />
....
<plugin name="cordova.plugins.diagnostic"/>

我的应用程序无法使用蓝牙,但是安装时需要获得与蓝牙设备链接的权限

音位间隙日志

...
...
Fetching plugin "cordova.plugins.diagnostic" via npm
Installing "cordova.plugins.diagnostic" at "4.0.8" for android
...
...

如果我删除一切都保持不变

最佳答案

诊断插件使用 npm postinstall hook运行 hook script它应用 config.xml 中的首选项来注释掉不需要的模块。

因此as documented :

It's vital that the preference be added to your config.xml before you install the plugin, otherwise the preference will not be applied and all modules will be added. This is because, due to limitations of the Cordova CLI hooks, this plugin must use the npm install process to apply the module preferences and this runs before the Cordova CLI when installing a plugin. If you change the modules specified in the preference, you'll need to uninstall then re-install the plugin to your project to apply the changes.

所以你应该尝试:

cordova plugin rm cordova.plugins.diagnostic --nosave
npm uninstall cordova.plugins.diagnostic
cordova plugin add cordova.plugins.diagnostic --nosave

注意:如果您在项目或 node_modules 中使用符号链接(symbolic link),这可能会导致脚本失败,因为它无法解析正确的相对路径。

免责声明:我是 Cordova 诊断插件的作者。

关于android - 没有蓝牙的蓝牙的phonegap权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51230731/

相关文章:

java - logcat-column '_id' 中的 JSON 到数据库创建错误不存在

android - 更新到 Android Studio 2.2/gradle 插件 2.2.0 : "could not get unknown property ' assembleRelease'"后

android - 使用绑定(bind)服务与在 Android 中创建新线程

android - Android BLE 数据写入问题 - 获取错误 133

android - RemoteViews 只注册第一个 PendingIntent

java - 在运行时传递参数 Dagger 2

Cordova 仅播放媒体插件

android - 在 Eclipse 中使用 Phonegap Android 开发的 HTML 表单输入

ios - 基于iOS版本的条件子类化

C++ Windows 到 Linux - 我需要知道什么?