title: How to control [Android] permissions with Phonegap?
body: <p>Sorry for the length of this. Please read on.</p>
  
  <p><strong>How can I configure phonegap's project files so that either <code>phonegap platform add</code> or <code>phonegap build</code> generate APK (or intermediate files that are used to generate APK) without any permissions, while not touching any of the <code>/platform/android/</code> files manually?</strong></p>
  
  <p>Below describes what I tried.</p>
  
  <p>I'm using the latest Phonegap and I'm trying to use CLI (so, not Adobe's build service). I went through everything that I could find online (documentation, forums, here) trying to find at least some hints on how to control the build process, preferably via config (specifically for Android), so that files in <code>/platforms/android/</code> (e.g. <code>AndroidManifest.xml</code>) get assembled the way that I want.</p>
  
  <p>For example, even with all plugins removed (<code>phonegap plugin remove [plugin name]</code> + manually removed <code>&lt;plugin</code> element from <code>/config.xml</code>, resulting in nothing but an empty json object in <code>/plugins/fetch.json</code>), I can't get <code>AndroidManifest.xml</code> to get created without these 3:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
  </code></pre>
  
  <p>I'd really not like to get into the discussion of why I'm trying to remove all permissions without manually changing <code>/platform/android/AndroidManifest.xml</code>. I previously used Visual Studio Cordova project template, and I was able to make this work (it's got a different file merge/replacement system, equivalent of which I'm trying to discover on Phonegap side). Both Phonegap and Cordova documentation in general are very selfish/basic, IMO (but, that's another topic).</p>
  
  <p>Of course, I've been removing/re-adding android-platform via <code>phonegap platform remove/add android</code> + <code>phonegap build android</code> each time after config change attempts (which I tried within <code>/config.xml</code>; I also tried to find a spot in the folder tree to place <code>AndroidManifest.xml</code> that would replace the one in <code>/platform/android</code>), but nothing worked. I've been verifying success/failure of my mission via <code>aapt d permissions "platforms\android\build\outputs\apk\android-debug.apk"</code>, and by manually checking generated <code>/platforms/android/AndroidManifest.xml</code>, and - no kidding - by release-bulding + signing + uploading to my Google account for their report of my APK (by that was before I discovered <code>aapt.exe</code>).</p>
  
  <p>If anyone can share some links, samples, book titles, or similar - I'd be grateful.</p>
  
  <p>Thank you.</p>