在 Android 上响应本机异步存储限制 [英] React native Async Storage Limit on Android

查看:39
本文介绍了在 Android 上响应本机异步存储限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个很容易超过 6mb 限制的 React Native 应用程序.根据 这个,我应该可以使用 setMaximumSize 方法,但是我不确定应该在我的项目中的何处或如何调用它.

I'm developing a React Native app which will easily exceed the 6mb limit. According to this, I should be able to use the method setMaximumSize, however I'm not sure of where or how I should invoke it in my project.

欢迎提供实际示例.

对于将来需要此功能的任何人,您可以这样做:

For anyone who needs this in the future here's how you do it:

    // MainApplication.getPackages()
long size = 50L * 1024L * 1024L; // 50 MB
com.facebook.react.modules.storage.ReactDatabaseSupplier.getInstance(getApplicationContext()).setMaximumSize(size);

推荐答案

尝试上面提到的新方法 在文档中 :

Try the new way as mentioned in the documentation :

AsyncStorage_db_size_in_MB 属性添加到您的 android/gradle.properties:

Add a AsyncStorage_db_size_in_MB property to your android/gradle.properties:

AsyncStorage_db_size_in_MB=10

现在您可以以 MB 为单位定义新大小.在此示例中,新限制为 10 MB.

Now you can define the new size in MB. In this example, the new limit is 10 MB.

这篇关于在 Android 上响应本机异步存储限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆