Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-device-info
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-device-info
Commits
e484701e
Unverified
Commit
e484701e
authored
Feb 08, 2018
by
Mehdi Achour
Committed by
GitHub
Feb 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: make getTotalDiskCapacity() and getFreeDiskStorage() available < SDK18 (#319)
parent
626d318f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
CHANGELOG.md
CHANGELOG.md
+4
-0
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+4
-4
No files found.
CHANGELOG.md
View file @
e484701e
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
### Next
### Next
### 0.15.1
*
Fix Android compatibility for
`getFreeDiskStorage`
and
`getTotalDiskCapacity`
(https://github.com/rebeccahughes/react-native-device-info/pull/319)
### 0.15.0
### 0.15.0
*
Add
`getFontScale`
(https://github.com/rebeccahughes/react-native-device-info/pull/278)
*
Add
`getFontScale`
(https://github.com/rebeccahughes/react-native-device-info/pull/278)
...
...
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
e484701e
...
@@ -127,15 +127,15 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
...
@@ -127,15 +127,15 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
}
}
@ReactMethod
@ReactMethod
public
long
getTotalDiskCapacity
()
{
public
int
getTotalDiskCapacity
()
{
StatFs
root
=
new
StatFs
(
Environment
.
getRootDirectory
().
getAbsolutePath
());
StatFs
root
=
new
StatFs
(
Environment
.
getRootDirectory
().
getAbsolutePath
());
return
root
.
getBlockCount
Long
()
*
root
.
getBlockSizeLong
();
return
root
.
getBlockCount
()
*
root
.
getBlockSize
();
}
}
@ReactMethod
@ReactMethod
public
long
getFreeDiskStorage
()
{
public
int
getFreeDiskStorage
()
{
StatFs
external
=
new
StatFs
(
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
());
StatFs
external
=
new
StatFs
(
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
());
return
external
.
getAvailableBlocks
Long
()
*
external
.
getBlockSizeLong
();
return
external
.
getAvailableBlocks
()
*
external
.
getBlockSize
();
}
}
@Override
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment