如何仅在一个Ionic平台上添加插件? [英] How to add a plugin on only one Ionic platform?

查看:53
本文介绍了如何仅在一个Ionic平台上添加插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ionic项目上使用了出色的背景地理位置插件.不幸的是,Apple认为我的用法不够有效,因此我必须弄清楚如何仅在Android上添加此插件.我无法在代码级别解决此问题,因为该插件的存在将我的应用标记为需要在info.plist中进行背景地理定位.

I am using the excellent background geolocation plugin on an Ionic project. Unfortunately Apple don't think my usage is valid enough so I have to work out how to add this plugin only on Android. I can't fix this at a code level because the very existence of the plugin marks my app as requiring background geolocation in info.plist.

Ionic(也许在package.json中)是否有一种方法可以将插件标记为仅安装在特定平台上?

Is there a way in Ionic (perhaps in package.json) to flag a plugin as only to be installed on one particular platform?

推荐答案

也许使用

Maybe use plugman to add plugin for specific platform:
First,install plugman:

$ npm install -g plugman

然后添加插件:

$ plugman install --platform <ios|android|blackberry10|wp8> --project <directory> --plugin <name|url|path>

根据您的情况,<目录> 应该是 platforms/android ,所以最终的安装命令是:

for your situation, <directory> should be platforms/android, so the finally installation command is:

$ plugman install --platform android --project platforms/android --plugin https://github.com/mauron85/cordova-plugin-background-geolocation.git

有关 plugman 的更多信息,请参考 cordova插件文件.希望这会有所帮助.

More about plugman, refer to cordova plugman docs.Hope this will help, regards.

这篇关于如何仅在一个Ionic平台上添加插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆