$ npm install react-native-datausagecheck --save
$ yarn add react-native-datausagecheck
$ react-native link react-native-datausagecheck
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.datausagecheck.RNDatausagecheckPackage;
to the imports at the top of the file - Add
new RNDatausagecheckPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-datausagecheck' project(':react-native-datausagecheck').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-datausagecheck/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-datausagecheck')
import RNDatausagecheck from 'react-native-datausagecheck';
// TODO: What to do with the module?
RNDatausagecheck.currentTodayDataUsage((msg) => {
console.log(Number(msg))
});