有没有到Android分配给一个应用程序内部存储最大尺寸是多少?应用程序、尺寸、最大、Android

2023-09-06 01:48:03 作者:言如初

我要保存所有的应用程序数据的JSON文件(类似于preference的东西),但林不知道什么是大小限制,因为如果应用程序不能使用这个文件也不起作用可能。是该信息预先已知并且OS保留一些空间保存应用或其基于可用的空间大小。

I want to save a json file with all the application data (something similar to preference) but im not sure what is the limit size, because if the app cant use this file it will not function probably. is this information known beforehand and the OS reserve some space for your app or its based on the size available.

更新: 我真的不关心外部存储,因为并不总是在设备可用,可以改变(SD卡),我可以检查的使用此内部存储,但是这不是我想知道的,我想知道是否有分配给内部存储设备内存的大小?

Update: I dont really care about External storage since is not always available in the device and could be changed (SD card) and i could check for internal storage using this but this is not what i want to know, What i want to know if there's a memory size allocated for internal storage for the device ?

推荐答案

如果您使用Environment.getExternalStorageDirectory() (或Context.getExternalFilesDir()为API级别8个,最多),为您的JSON文件的地方,那么相信的尺寸将通过在外部存储的可用空间(通常是SD卡)的限制。对于大多数的设备,我相信有内​​置的Andr​​oid外部文件存储没有固定的限制。 (内部存储是一个不同的问题。设备制造商可并处相当严格的限制,可能低至100MB的所有应用程序之间共享。)

If you use Environment.getExternalStorageDirectory() (or Context.getExternalFilesDir() for API level 8 and up) as the place for your json file, then I believe the size will be limited by the available space in the external storage (usually an SD card). For most devices, I believe there are no fixed limits built into Android for external file storage. (Internal storage is a different matter. Device manufacturers can impose quite restrictive limits, perhaps as low as 100MB shared among all applications.)

更新:根据compatibility定义为Android 2.3 (第7.6.1节),设备应具有相当多的内存:

UPDATE: Note that according to the compatibility definition for Android 2.3 (Section 7.6.1), devices should have quite a bit of memory:

设备实现必须具有至少150MB的非易失性存储可用于用户数据。也就是说,在/ data分区必须至少有150MB。

Device implementations MUST have at least 150MB of non-volatile storage available for user data. That is, the /data partition MUST be at least 150MB.

除了上述的要求,设备的实现应该具有的非易失性存储至少1GB可用于用户数据。注意,这   更高的要求,计划成为一个硬最小的Andr​​oid的未来版本。设备实现强烈建议,以满足   这些要求现在,否则他们可能没有资格为Android的未来版本的兼容性。

Beyond the requirements above, device implementations SHOULD have at least 1GB of non-volatile storage available for user data. Note that this higher requirement is planned to become a hard minimum in a future version of Android. Device implementations are strongly encouraged to meet these requirements now, or else they may not be eligible for compatibility for a future version of Android.

这空间所有应用程序共享,所以它可以填补。有没有保证的最小存储可用于每个应用程序。 (这样的最低保证是毫无价值对于需要存储超过最低,将是浪费的存储更少的应用程序的应用程序。)

This space is shared by all applications, so it can fill up. There is no guaranteed minimum storage available for each app. (Such a guaranteed minimum would be worthless for apps that need to store more than the minimum and would be a waste for apps that store less.)

修改:从compatibility定义的Andr​​oid 4.0

设备实现必须具有至少350MB的非易失性存储可用于用户数据。也就是说,在/ data分区必须至少有350MB。

Device implementations MUST have at least 350MB of non-volatile storage available for user data. That is, the /data partition MUST be at least 350MB.

在compatibility定义为Android 4.3

设备实现必须拥有至少512MB的非易失性存储器可用于用户数据。也就是说,在/ data分区必须至少有512MB。

谁 吃 了手机存储空间 分析解决才是王道

Device implementations MUST have at least 512MB of non-volatile storage available for user data. That is, the /data partition MUST be at least 512MB.

有趣的是,实现应提供建议至少1GB一直保持不变。

Interestingly, the recommendation that implementations SHOULD provide at least 1GB has stayed the same.