Skip to content

Commit e281490

Browse files
committed
Make Android default persistent file location internal
1 parent 19c8a79 commit e281490

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ application's `config.xml` file. To do this, add one of these two lines to
214214

215215
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
216216

217-
Without this line, the File plugin will use `Compatibility` as the default. If
217+
Without this line, the File plugin will use `Internal` as the default. If
218218
a preference tag is present, and is not one of these values, the application
219219
will not start.
220220

221221
If your application has previously been shipped to users, using an older (pre-
222-
1.0) version of this plugin, and has stored files in the persistent filesystem,
223-
then you should set the preference to `Compatibility`. Switching the location to
222+
3.0.0) version of this plugin, and has stored files in the persistent filesystem,
223+
then you should set the preference to `Compatibility` if your config.xml does not specify a location for the persistent filesystem. Switching the location to
224224
"Internal" would mean that existing users who upgrade their application may be
225225
unable to access their previously-stored files, depending on their device.
226226

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-plugin-file",
3-
"version": "2.1.1-dev",
3+
"version": "3.0.0",
44
"description": "Cordova File Plugin",
55
"cordova": {
66
"id": "cordova-plugin-file",

plugin.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
2222
xmlns:android="http://schemas.android.com/apk/res/android"
2323
id="cordova-plugin-file"
24-
version="2.1.1-dev">
24+
version="3.0.0">
2525
<name>File</name>
2626
<description>Cordova File Plugin</description>
2727
<license>Apache 2.0</license>
@@ -104,6 +104,23 @@ xmlns:android="http://schemas.android.com/apk/res/android"
104104
<js-module src="www/resolveLocalFileSystemURI.js" name="resolveLocalFileSystemURI">
105105
<merges target="window" />
106106
</js-module>
107+
108+
<config-file target="config.xml" parent="/*">
109+
<preference name="AndroidPersistentFileLocation" value="Internal" />
110+
</config-file>
111+
112+
<info>
113+
The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.
114+
115+
If this is a new application no changes are required.
116+
117+
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
118+
119+
"&lt;preference name="AndroidPersistentFileLocation" value="Compatibility" /&gt;"
120+
121+
to config.xml in order for the application to find previously stored files.
122+
123+
</info>
107124

108125
<!-- android -->
109126
<platform name="android">

src/android/FileUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
153153
Activity activity = cordova.getActivity();
154154
String packageName = activity.getPackageName();
155155

156-
String location = preferences.getString("androidpersistentfilelocation", "compatibility");
156+
String location = preferences.getString("androidpersistentfilelocation", "internal");
157157

158158
tempRoot = activity.getCacheDir().getAbsolutePath();
159159
if ("internal".equalsIgnoreCase(location)) {

0 commit comments

Comments
 (0)