From 587c68f7decfc6f71e8711c0c38238997b0f2640 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Wed, 8 May 2019 16:15:54 +0200 Subject: [PATCH 01/15] db size on android is now configurable --- .../asyncstorage/AsyncStorageModule.java | 8 ++++---- .../asyncstorage/AsyncStoragePackage.java | 19 ++++++++++++++++--- .../asyncstorage/ReactDatabaseSupplier.java | 9 +++++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java index f15a5132..3217cb62 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java @@ -81,15 +81,15 @@ synchronized void scheduleNext() { private final SerialExecutor executor; - public AsyncStorageModule(ReactApplicationContext reactContext) { - this(reactContext, AsyncTask.THREAD_POOL_EXECUTOR); + public AsyncStorageModule(ReactApplicationContext reactContext, long size) { + this(reactContext, AsyncTask.THREAD_POOL_EXECUTOR, size); } @VisibleForTesting - AsyncStorageModule(ReactApplicationContext reactContext, Executor executor) { + AsyncStorageModule(ReactApplicationContext reactContext, Executor executor, long size) { super(reactContext); this.executor = new SerialExecutor(executor); - mReactDatabaseSupplier = ReactDatabaseSupplier.getInstance(reactContext); + mReactDatabaseSupplier = ReactDatabaseSupplier.getInstance(reactContext, size); } @Override diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java index 25eb5a14..5e26196d 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java @@ -18,12 +18,25 @@ import java.util.List; public class AsyncStoragePackage implements ReactPackage { + + + long mSize = 6L * 1024L * 1024L; + + public AsyncStoragePackage(){ + super(); + } + + public AsyncStoragePackage(long size){ + super(); + mSize = size; + } + @Override public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new AsyncStorageModule(reactContext)); + return Arrays.asList(new AsyncStorageModule(reactContext, mSize)); } - // Deprecated in RN 0.47 + // Deprecated in RN 0.47 public List> createJSModules() { return Collections.emptyList(); } @@ -33,4 +46,4 @@ public List> createJSModules() { public List createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } -} \ No newline at end of file +} diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java index 9f992ca4..4dc8dc2c 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - + package com.reactnativecommunity.asyncstorage; import javax.annotation.Nullable; @@ -45,14 +45,15 @@ public class ReactDatabaseSupplier extends SQLiteOpenHelper { private @Nullable SQLiteDatabase mDb; private long mMaximumDatabaseSize = 6L * 1024L * 1024L; // 6 MB in bytes - private ReactDatabaseSupplier(Context context) { + private ReactDatabaseSupplier(Context context, long size) { super(context, DATABASE_NAME, null, DATABASE_VERSION); mContext = context; + mMaximumDatabaseSize = size; } - public static ReactDatabaseSupplier getInstance(Context context) { + public static ReactDatabaseSupplier getInstance(Context context, long size) { if (sReactDatabaseSupplierInstance == null) { - sReactDatabaseSupplierInstance = new ReactDatabaseSupplier(context.getApplicationContext()); + sReactDatabaseSupplierInstance = new ReactDatabaseSupplier(context.getApplicationContext(), size); } return sReactDatabaseSupplierInstance; } From c2d59081e7f60fc115a81bd342f86866b3fd8687 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Wed, 8 May 2019 16:20:58 +0200 Subject: [PATCH 02/15] removed line break --- .../reactnativecommunity/asyncstorage/AsyncStoragePackage.java | 1 - 1 file changed, 1 deletion(-) diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java index 5e26196d..65a2f695 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java @@ -19,7 +19,6 @@ public class AsyncStoragePackage implements ReactPackage { - long mSize = 6L * 1024L * 1024L; public AsyncStoragePackage(){ From f840a7f0e71faf752bd04ac7c10d3a0560d3a87d Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 10:07:20 +0200 Subject: [PATCH 03/15] added documentation for increased storage size on android --- README.md | 3 ++- .../BrownfieldIntegration.md} | 0 docs/advanced/IncreaseDbSize.md | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) rename docs/{AdvancedUsage.md => advanced/BrownfieldIntegration.md} (100%) create mode 100644 docs/advanced/IncreaseDbSize.md diff --git a/README.md b/README.md index 006834c9..3c3c3c31 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ getData = async () => { ``` -See docs for [api and more examples](docs/API.md), and [brownfield integration guide](docs/AdvancedUsage.md). +### Advanced +See docs for [api and more examples](docs/API.md), [brownfield integration guide](docs/advanced/BrownfieldIntegration.md) and [increased storage size on Android](docs/advanced/IncreaseDbSize.md) . ## Writing tests diff --git a/docs/AdvancedUsage.md b/docs/advanced/BrownfieldIntegration.md similarity index 100% rename from docs/AdvancedUsage.md rename to docs/advanced/BrownfieldIntegration.md diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md new file mode 100644 index 00000000..d4282a90 --- /dev/null +++ b/docs/advanced/IncreaseDbSize.md @@ -0,0 +1,25 @@ +# Increase AsyncStorage Database Size on Android + +On Android there is a default size limit of 6MB an AsyncStorage. If you try to add more data to your AsyncStorage you will recieve an error like this: + +``` +database or disk is full (code 13) +``` + +Disclaimer: This 6MB limit is a sane limit to protect the user from the app storing too much data in the database. This also protects the database from filling up the disk cache and becoming malformed (endTransaction() calls will throw an exception, not rollback, and leave the db malformed). You have to be aware of that risk when increasing the database size. We recommend to ensure that your app does not write more data to AsyncStorage than space is left on disk. Since AsyncStorage is based on SQLite on Android you also have to be aware of the [SQLite limits](https://www.sqlite.org/limits.html). + +### How to increase DB size + +Go to your MainApplication.java and change the initialization of AsyncStorage in your getPackages() from + +``` +new AsyncStorage() +``` + +to + +``` +new AsyncStorage(100L * 1024L * 1024L) +``` + +where the 100 defines the number in MB, the new database limit will be. In this example the new database size is 100 MB. From aab59e3886ab639ca3ef2b5b96385704162e2db3 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:37:57 +0200 Subject: [PATCH 04/15] Update README.md Co-Authored-By: Krzysztof Borowy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c3c3c31..3fb189b8 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ getData = async () => { ``` ### Advanced -See docs for [api and more examples](docs/API.md), [brownfield integration guide](docs/advanced/BrownfieldIntegration.md) and [increased storage size on Android](docs/advanced/IncreaseDbSize.md) . +See docs for [api and more examples](docs/API.md) or [advanced usages](docs/advanced). ## Writing tests From 17a953cc4ff7e04e1c168bbe9100c4de71413da6 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:39:37 +0200 Subject: [PATCH 05/15] Update docs/advanced/IncreaseDbSize.md Co-Authored-By: Krzysztof Borowy --- docs/advanced/IncreaseDbSize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index d4282a90..7c11539a 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -1,6 +1,6 @@ # Increase AsyncStorage Database Size on Android -On Android there is a default size limit of 6MB an AsyncStorage. If you try to add more data to your AsyncStorage you will recieve an error like this: +Current Async Storage's size is set to 6MB. Going over this limit causes `database or disk is full` error. ``` database or disk is full (code 13) From 3bb688bb28fa7b34f8dfac48ab2404ce5dd074d3 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:39:50 +0200 Subject: [PATCH 06/15] Update docs/advanced/IncreaseDbSize.md Co-Authored-By: Krzysztof Borowy --- docs/advanced/IncreaseDbSize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index 7c11539a..7e7a21cf 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -8,7 +8,7 @@ database or disk is full (code 13) Disclaimer: This 6MB limit is a sane limit to protect the user from the app storing too much data in the database. This also protects the database from filling up the disk cache and becoming malformed (endTransaction() calls will throw an exception, not rollback, and leave the db malformed). You have to be aware of that risk when increasing the database size. We recommend to ensure that your app does not write more data to AsyncStorage than space is left on disk. Since AsyncStorage is based on SQLite on Android you also have to be aware of the [SQLite limits](https://www.sqlite.org/limits.html). -### How to increase DB size +### Increase limit Go to your MainApplication.java and change the initialization of AsyncStorage in your getPackages() from From d7d6ad063452221a7858dcc076ef33be37f9e0a5 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:40:15 +0200 Subject: [PATCH 07/15] Update docs/advanced/IncreaseDbSize.md Co-Authored-By: Krzysztof Borowy --- docs/advanced/IncreaseDbSize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index 7e7a21cf..e2729858 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -10,7 +10,7 @@ Disclaimer: This 6MB limit is a sane limit to protect the user from the app stor ### Increase limit -Go to your MainApplication.java and change the initialization of AsyncStorage in your getPackages() from +Modify your `MainApplication.java`'s `getPackages`: ``` new AsyncStorage() From 573777d620ba93fc154b250efee4b7a843df8313 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:40:30 +0200 Subject: [PATCH 08/15] Update docs/advanced/IncreaseDbSize.md Co-Authored-By: Krzysztof Borowy --- docs/advanced/IncreaseDbSize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index e2729858..189b6fbe 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -22,4 +22,4 @@ to new AsyncStorage(100L * 1024L * 1024L) ``` -where the 100 defines the number in MB, the new database limit will be. In this example the new database size is 100 MB. +Where the 100 defines the new size in MB. In this example, new limit is 100 MB. From 93f0ee2af833def40c26d2110c89d985aad851b2 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:40:45 +0200 Subject: [PATCH 09/15] Update docs/advanced/IncreaseDbSize.md Co-Authored-By: Krzysztof Borowy --- docs/advanced/IncreaseDbSize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index 189b6fbe..d3359a12 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -1,4 +1,4 @@ -# Increase AsyncStorage Database Size on Android +# Increase Async Storage size Current Async Storage's size is set to 6MB. Going over this limit causes `database or disk is full` error. From 7a5e0d3d5eddadc7e5f005599d09e38b305020b2 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Thu, 9 May 2019 12:43:43 +0200 Subject: [PATCH 10/15] added android/ios sections to db size docs --- docs/advanced/IncreaseDbSize.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index d3359a12..a8754a5b 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -1,5 +1,7 @@ # Increase Async Storage size +## Android + Current Async Storage's size is set to 6MB. Going over this limit causes `database or disk is full` error. ``` @@ -23,3 +25,8 @@ new AsyncStorage(100L * 1024L * 1024L) ``` Where the 100 defines the new size in MB. In this example, new limit is 100 MB. + + +## iOS + +Async Storage size is not limited programmatically on iOS. From 230e1c4aceff27b0fd762c426911588c1aa59b0d Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Fri, 10 May 2019 11:33:32 +0200 Subject: [PATCH 11/15] moved db size change on android to gradle build process --- android/build.gradle | 15 ++++++++++++++- android/gradle.properties | 5 ++++- .../asyncstorage/AsyncStorageModule.java | 8 ++++---- .../asyncstorage/AsyncStoragePackage.java | 11 ----------- .../asyncstorage/ReactDatabaseSupplier.java | 9 ++++----- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 1d0cb61c..a0f27701 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -18,6 +18,18 @@ def getExtOrIntegerDefault(name) { return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RNAsyncStorage_' + name]).toInteger() } +// AsyncStorage has default size of 6MB. +// This is a sane limit to protect the user from the app storing too much data in the database. +// This also protects the database from filling up the disk cache and becoming malformed. +// If you really need bigger size, please keep in mind the potential consequences. +long dbSizeInMB = 6L + +def newDbSize = rootProject.properties['AsyncStorage_db_size_in_MB'] + +if( newDbSize != null && newDbSize.isLong()) { + dbSizeInMB = newDbSize.toLong() +} + apply plugin: 'com.android.library' android { @@ -27,6 +39,8 @@ android { defaultConfig { minSdkVersion getExtOrIntegerDefault('minSdkVersion') targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') + + buildConfigField "Long", "AsyncStorage_db_size", "${dbSizeInMB}L" } } @@ -37,4 +51,3 @@ repositories { dependencies { implementation 'com.facebook.react:react-native:+' } - \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index 109465ba..b9ad8f50 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,7 @@ RNAsyncStorage_compileSdkVersion=28 RNAsyncStorage_buildToolsVersion=28.0.3 RNAsyncStorage_targetSdkVersion=28 -RNAsyncStorage_minSdkVersion=19 \ No newline at end of file +RNAsyncStorage_minSdkVersion=19 + +# If you know what you're doing, you can uncomment this line and increase the size of db +# AsyncStorage_db_size_in_MB=10 diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java index 3217cb62..f15a5132 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java @@ -81,15 +81,15 @@ synchronized void scheduleNext() { private final SerialExecutor executor; - public AsyncStorageModule(ReactApplicationContext reactContext, long size) { - this(reactContext, AsyncTask.THREAD_POOL_EXECUTOR, size); + public AsyncStorageModule(ReactApplicationContext reactContext) { + this(reactContext, AsyncTask.THREAD_POOL_EXECUTOR); } @VisibleForTesting - AsyncStorageModule(ReactApplicationContext reactContext, Executor executor, long size) { + AsyncStorageModule(ReactApplicationContext reactContext, Executor executor) { super(reactContext); this.executor = new SerialExecutor(executor); - mReactDatabaseSupplier = ReactDatabaseSupplier.getInstance(reactContext, size); + mReactDatabaseSupplier = ReactDatabaseSupplier.getInstance(reactContext); } @Override diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java index 65a2f695..bef1038f 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java @@ -19,17 +19,6 @@ public class AsyncStoragePackage implements ReactPackage { - long mSize = 6L * 1024L * 1024L; - - public AsyncStoragePackage(){ - super(); - } - - public AsyncStoragePackage(long size){ - super(); - mSize = size; - } - @Override public List createNativeModules(ReactApplicationContext reactContext) { return Arrays.asList(new AsyncStorageModule(reactContext, mSize)); diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java index 4dc8dc2c..6e191de2 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java @@ -43,17 +43,16 @@ public class ReactDatabaseSupplier extends SQLiteOpenHelper { private Context mContext; private @Nullable SQLiteDatabase mDb; - private long mMaximumDatabaseSize = 6L * 1024L * 1024L; // 6 MB in bytes + private long mMaximumDatabaseSize = BuildConfig.AsyncStorage_db_size * 1024L * 1024L; - private ReactDatabaseSupplier(Context context, long size) { + private ReactDatabaseSupplier(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); mContext = context; - mMaximumDatabaseSize = size; } - public static ReactDatabaseSupplier getInstance(Context context, long size) { + public static ReactDatabaseSupplier getInstance(Context context) { if (sReactDatabaseSupplierInstance == null) { - sReactDatabaseSupplierInstance = new ReactDatabaseSupplier(context.getApplicationContext(), size); + sReactDatabaseSupplierInstance = new ReactDatabaseSupplier(context.getApplicationContext()); } return sReactDatabaseSupplierInstance; } From 0ba4992b77ca13d2ded5ee2d11798e2beb29dd56 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Fri, 10 May 2019 11:44:05 +0200 Subject: [PATCH 12/15] moved size gradle prop to example project --- android/gradle.properties | 3 --- example/android/gradle.properties | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/android/gradle.properties b/android/gradle.properties index b9ad8f50..b1d75861 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,6 +2,3 @@ RNAsyncStorage_compileSdkVersion=28 RNAsyncStorage_buildToolsVersion=28.0.3 RNAsyncStorage_targetSdkVersion=28 RNAsyncStorage_minSdkVersion=19 - -# If you know what you're doing, you can uncomment this line and increase the size of db -# AsyncStorage_db_size_in_MB=10 diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 89e0d99e..f950a74e 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -16,3 +16,7 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + + +# If you know what you're doing, you can uncomment this line and increase the size of db +# AsyncStorage_db_size_in_MB=10 From 0efc5959e2a983d4a04488e5577b3847d2d91b4e Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Fri, 10 May 2019 11:48:39 +0200 Subject: [PATCH 13/15] updated docs for new db increase process --- docs/advanced/IncreaseDbSize.md | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/docs/advanced/IncreaseDbSize.md b/docs/advanced/IncreaseDbSize.md index a8754a5b..b2c36bde 100644 --- a/docs/advanced/IncreaseDbSize.md +++ b/docs/advanced/IncreaseDbSize.md @@ -2,29 +2,17 @@ ## Android -Current Async Storage's size is set to 6MB. Going over this limit causes `database or disk is full` error. - -``` -database or disk is full (code 13) -``` - -Disclaimer: This 6MB limit is a sane limit to protect the user from the app storing too much data in the database. This also protects the database from filling up the disk cache and becoming malformed (endTransaction() calls will throw an exception, not rollback, and leave the db malformed). You have to be aware of that risk when increasing the database size. We recommend to ensure that your app does not write more data to AsyncStorage than space is left on disk. Since AsyncStorage is based on SQLite on Android you also have to be aware of the [SQLite limits](https://www.sqlite.org/limits.html). +Current Async Storage's size is set to 6MB. Going over this limit causes `database or disk is full` error. This 6MB limit is a sane limit to protect the user from the app storing too much data in the database. This also protects the database from filling up the disk cache and becoming malformed (endTransaction() calls will throw an exception, not rollback, and leave the db malformed). You have to be aware of that risk when increasing the database size. We recommend to ensure that your app does not write more data to AsyncStorage than space is left on disk. Since AsyncStorage is based on SQLite on Android you also have to be aware of the [SQLite limits](https://www.sqlite.org/limits.html). ### Increase limit -Modify your `MainApplication.java`'s `getPackages`: - -``` -new AsyncStorage() -``` - -to +Add a `AsyncStorage_db_size_in_MB` property to your `android/gradle.properties`: ``` -new AsyncStorage(100L * 1024L * 1024L) +AsyncStorage_db_size_in_MB=10 ``` -Where the 100 defines the new size in MB. In this example, new limit is 100 MB. +Now you can define the new size in MB. In this example, the new limit is 10 MB. ## iOS From ed57c1f6d96fe6cd859bdba8aeaf1d382ebf4daa Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Fri, 10 May 2019 11:54:32 +0200 Subject: [PATCH 14/15] fixed revert --- .../reactnativecommunity/asyncstorage/AsyncStoragePackage.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java index bef1038f..91e6b843 100644 --- a/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +++ b/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java @@ -18,10 +18,9 @@ import java.util.List; public class AsyncStoragePackage implements ReactPackage { - @Override public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new AsyncStorageModule(reactContext, mSize)); + return Arrays.asList(new AsyncStorageModule(reactContext)); } // Deprecated in RN 0.47 From 1ad778e8c2fd872a14c2257899a82c8c265d9fc9 Mon Sep 17 00:00:00 2001 From: Alexander Kuttig Date: Fri, 10 May 2019 11:58:53 +0200 Subject: [PATCH 15/15] removed line-break