1.2.0 • Published 2 years ago

rn-bugly v1.2.0

Weekly downloads
15
License
MIT
Repository
github
Last release
2 years ago

rn-bugly

npm version npm version

bugly for react-native,支持统计,android支持应用升级

安装

$ npm install rn-bugly --save

react-native <0.60

$ react-native link rn-bugly

react-native >=0.60

新版RN会自动link,但是需要在`ios`文件夹下执行

$ pod install

Manual installation(针对RN 0.60以下版本)

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesrn-bugly and add RNBugly.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNBugly.a and Bugly.framework to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

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

      implementation project(':rn-bugly')

配置

iOS

AppDelegate.m

#import "RNBugly.h"
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  //初始化bugly,会自动读取info.plist中的参数
  [RNBugly startWithAppId];
	return YES;
}

info.plist文件读取SDK初始化参数,可配置的参数如下:

- Appid
    - Key: BuglyAppIDString
    - Value: 字符串类型
- 渠道标识
    - Key: BuglyAppChannelString
    - Value: 字符串类型
- 版本信息
    - Key: BuglyAppVersionString
    - Value: 字符串类型
- 开启Debug信息显示
    - Key: BuglyDebugEnable
    - Value: BOOL类型

Android

MainApplication.java

import com.tencent.bugly.Bugly;

@Override
public void onCreate() {
  super.onCreate();
  //初始化bugly,init方法会自动检查更新,不需要再手动调用
  //参数解析:
  //参数1:上下文对象
  //参数2:注册时申请的APPID
  //参数3:是否开启debug模式,true表示打开debug模式,false表示关闭调试模式
  Bugly.init(getApplicationContext(),"注册时申请的APPID",false);
  ...
}

使用

import RNBugly from 'rn-bugly';

具体方法请查看: index.d.ts

1.3.0-beta.3

2 years ago

1.2.0

2 years ago

1.3.0-beta.1

2 years ago

1.3.0-beta.2

2 years ago

1.1.0

3 years ago

0.3.3-beta2

3 years ago

0.3.3-beta1

3 years ago

0.3.3

3 years ago

0.3.2-beta5

3 years ago

0.3.2-beta4

3 years ago

0.3.2-beta1

3 years ago

0.3.2-beta3

3 years ago

0.3.2-beta2

3 years ago

0.3.2

3 years ago

0.3.1-beta1

3 years ago

0.3.1

3 years ago

0.3.0-beta1

4 years ago

0.3.0-beta2

4 years ago

0.3.0-beta3

4 years ago

0.3.0

4 years ago

0.2.1-beta7

4 years ago

0.2.1-beta6

4 years ago

0.2.1-beta4

4 years ago

0.2.1-beta5

4 years ago

0.2.1-beta3

4 years ago

0.2.1-beta1

4 years ago

0.2.1-beta2

4 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago

1.0.0

5 years ago