[ 
https://issues.apache.org/jira/browse/CB-13301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andres Zsogon updated CB-13301:
-------------------------------
    Description: 
Currently, the Move to SD card option in Android is disabled by default. We 
have to create this hook to edit the manifest and allow moving it to SD card:

{code:javascript}
#!/usr/bin/env node
// Adds lines to the Android Manifest if they are not already there
const LINES_TO_ADD = [
    {
        text: ' android:installLocation="auto"', /* allow moving app to SD card 
*/
        after: '<manifest'
    }
];
const MANIFEST = 'platforms/android/AndroidManifest.xml';
var fs = require('fs'),
  manifestText = fs.readFileSync(MANIFEST).toString();
LINES_TO_ADD.forEach(function(lineToAdd) {
  if(manifestText.indexOf(lineToAdd.text) === -1) {
    manifestText = manifestText.replace(lineToAdd.after, lineToAdd.after + 
lineToAdd.text);
  }
});
fs.writeFileSync(MANIFEST, manifestText);
{code}

However, if we compile for Windows Universal for the first time and there is no 
Android manifest, build fails. Also it is very annoying to use hooks for 
essential features such as this.

  was:
Currently, the Move to SD card option in Android is disabled by default. We 
have to create this hook to edit the manifest and allow moving it to SD card:

{{#!/usr/bin/env node
// Adds lines to the Android Manifest if they are not already there
const LINES_TO_ADD = [
    {
        text: ' android:installLocation="auto"', /* allow moving app to SD card 
*/
        after: '<manifest'
    }
];
const MANIFEST = 'platforms/android/AndroidManifest.xml';
var fs = require('fs'),
  manifestText = fs.readFileSync(MANIFEST).toString();
LINES_TO_ADD.forEach(function(lineToAdd) {
  if(manifestText.indexOf(lineToAdd.text) === -1) {
    manifestText = manifestText.replace(lineToAdd.after, lineToAdd.after + 
lineToAdd.text);
  }
});
fs.writeFileSync(MANIFEST, manifestText);}}

However, if we compile for Windows Universal for the first time and there is no 
Android manifest, build fails. Also it is very annoying to use hooks for 
essential features such as this.


> Add config.xml option to allow moving app to SD Card
> ----------------------------------------------------
>
>                 Key: CB-13301
>                 URL: https://issues.apache.org/jira/browse/CB-13301
>             Project: Apache Cordova
>          Issue Type: Wish
>          Components: cordova-android
>    Affects Versions: Master
>         Environment: Visual Studio 201x
>            Reporter: Andres Zsogon
>            Assignee: Joe Bowser
>            Priority: Minor
>              Labels: android, config.xml, features
>             Fix For: 6.4.0
>
>
> Currently, the Move to SD card option in Android is disabled by default. We 
> have to create this hook to edit the manifest and allow moving it to SD card:
> {code:javascript}
> #!/usr/bin/env node
> // Adds lines to the Android Manifest if they are not already there
> const LINES_TO_ADD = [
>     {
>         text: ' android:installLocation="auto"', /* allow moving app to SD 
> card */
>         after: '<manifest'
>     }
> ];
> const MANIFEST = 'platforms/android/AndroidManifest.xml';
> var fs = require('fs'),
>   manifestText = fs.readFileSync(MANIFEST).toString();
> LINES_TO_ADD.forEach(function(lineToAdd) {
>   if(manifestText.indexOf(lineToAdd.text) === -1) {
>     manifestText = manifestText.replace(lineToAdd.after, lineToAdd.after + 
> lineToAdd.text);
>   }
> });
> fs.writeFileSync(MANIFEST, manifestText);
> {code}
> However, if we compile for Windows Universal for the first time and there is 
> no Android manifest, build fails. Also it is very annoying to use hooks for 
> essential features such as this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to