react-native-uptime

1.0.1 • Public • Published

react-native-uptime

Getting started

$ npm install react-native-uptime --save

Installation

iOS

In XCode, in the project navigator:

  1. Right click LibrariesAdd Files to [your project's name], go to node_modulesreact-native-uptime and add RNUptime.xcodeproj
  2. Add libRNUptime.a to your project's Build PhasesLink Binary With Libraries
  3. Add $(SRCROOT)/../node_modules/react-native-uptime/ios to your project's Build SettingsHeader Search Paths entry
  4. In your AppDelegate.m file, add the following code after the RN bridge initialization:
    #import "RNUptime.h"
    
    ...
    
    RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
    [RNUptime initializeWithBridge:bridge];
    
    ...
    
  5. Run your project (Cmd+R)

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add to the imports at the top of the file:
    import com.rnuptime.RNUptimeModule;
    import com.rnuptime.RNUptimePackage;
  • Add new RNUptimePackage(), to the list returned by the getPackages() method
    • Add RNUptimeModule.start(); to the onCreate() method.
  1. Append the following lines to android/settings.gradle:
    include ':react-native-uptime'
    project(':react-native-uptime').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-uptime/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-uptime')
    

Usage

import * as RNUptime from 'react-native-uptime';

const perfData = RNUptime.getPerfData();
console.log('App finished launching with metrics:', perfData);

Readme

Keywords

Package Sidebar

Install

npm i react-native-uptime

Weekly Downloads

7

Version

1.0.1

License

private

Unpacked Size

24 kB

Total Files

22

Last publish

Collaborators

  • sameerk129