0 Replies Latest reply on May 2, 2017 4:27 AM by utzzim

    How to edit android manifest from within the config.xml in order to save play store key?

    utzzim

      Hello,

      I tried hard to find an answer to this question but can’t find it.

       

      I am using the online build service to generate a little game and would love to add the plugin <cordova-plugin-inapppurchase>.

      The android part in the manual of this plugin explains:

      ______________________________________________________________________________________________________

      You must create a manifest.json in your project's www folder with your Android Billing Key:

      { "play_store_key": "<Base64-encoded public key from the Google Play Store>" }

      ______________________________________________________________________________________________________

       

      Please explain how to manage this via the config.xml?

      I have a play store key and can’t figure out how to edit the config.xml in order to save my key into the manifest file.

       

      I found this article: Modifying Manifests | PhoneGap Docs, but unfortunately I can’t figure out how to do it. I am getting errors from my config.xml.

      It would be a great help to have an example with the billing key.

       

      Many thanks for an answer

      ________________________

      Added:

       

      I finally managed to edit manifest file without getting errors in return (but still not sure if it is going to work).
      In case someone else likes to know, here is what i added to my config.xml:

       

      Like explained in the above link, the head of config. xml has to have this extra line (added in green here):

      <?xml version="1.0" encoding="UTF-8"?>

      <widget xmlns ="http://www.w3.org/ns/widgets"

           xmlns:gap ="http://phonegap.com/ns/1.0"

           xmlns:android = "http://schemas.android.com/apk/res/android"

      . . .

       

      Then i added the extra information with my play store key like this (just behind the part <platform name="android">...</platform>):

       

      <config-file platform="android" parent="/manifest" mode="merge">

           <preference name="play_store_key" value = "MIIBIjA..." />

      </config-file>

       

      After building my app again I decompiled the returned apk-file with apktools and found this extra line inside the AndroidManifest.xml:

      <preference name="play_store_key" value="MIIBIjA..."/>

       

      Hooray!

       

      Now I can go on trying to adapt my app to the plugin. I hope this will help someone else, as well.

       

      I still can’t believe how long it took me to figure this out!
      Whoever can read definitely has an advantage!