Skip to content

kilp/react-native-talkingdata

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-talkingdata

React Native的TalkingData插件

如何安装

首先安装npm包

npm install react-native-talkingdata --save

link

rnpm link

Note: rnpm requires node version 4.1 or higher

iOS工程配置

在工程target的Build Phases->Link Binary with Libraries中加入、CoreTelephony.framework、AdSupport.framework、SystemConfiguration.framework、Security.framework、CoreMotion.framework、liz.tbd

在你工程的AppDelegate.m文件中添加如下代码:

#import "RCTTalkingData.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	// 添加在第一行
  [RCTTalkingData registerApp:@"APPID" channelID:@"渠道号" crashReport:YES];
  ...
  ...

}

安装Android工程

android/app/build.gradle里,defaultConfig栏目下添加如下代码:

	manifestPlaceholders = [
           TD_APPID: "talkingdata的APPID",//在此修改微信APPID
           APP_CHANNEL: "渠道号",
   	]

在你自定义的MainActivity的onCreate()中第一行加入

	TalkingDataModule.register(getApplicationContext(), null, null, true);

如何使用

引入包

import * as TD from 'react-native-talkingdata';

API

TD.trackPageBegin(page_name)

TD.trackPageEnd(page_name)

TD.trackEvent(event_name, event_label, parameters)

TD.setLocation(latitude, longitude)

TD.getDeviceID()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 61.8%
  • Java 33.2%
  • JavaScript 5.0%