简体   繁体   English

如何为cordova phonegap项目的config.xml文件添加计费权限?

[英]How to add billing permissions to config.xml file for cordova phonegap project?

I'm attempting to add android billing permission to my phonegap cordova project using config.xml.我正在尝试使用 config.xml 向我的 phonegap cordova 项目添加 android 计费权限。 It isn't working.它不起作用。

I've tried using edit-config.我试过使用编辑配置。 I've tried adding xmlns:android to the widget.我尝试将 xmlns:android 添加到小部件。

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.widlugames.theotherside" version="1.1.4" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android">
    <name>TheOtherSide</name>
    <description>
        An interactive novel
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="android-minSdkVersion" value="26"/>
    <preference name="android-maxSdkVersion" value="28"/>

    <platform name="android">
    <edit-config file="AndroidManifest.xml" target="/manifest/uses-permission" mode="merge">
        <uses-permission android:name="com.android.vending.BILLING" />
    </edit-config>
    </platform>

</widget>

I expect to be able to upload the apk to google play and be able to add in-app purchases, however when I upload the apk it says I need to add android billing permissions before I can add purchases.我希望能够将 apk 上传到 google play 并能够添加应用内购买,但是当我上传 apk 时,它说我需要添加 android 计费权限才能添加购买。

Replace your existing with your existing platform tag with the one below and try it:用您现有的platform标签替换您现有的platform标签并尝试使用以下标签:

<platform name="android">
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            <uses-permission android:name="com.android.vending.BILLING" />
        </edit-config>
</platform>

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

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