1.1.5 • Published 2 years ago

react-native-im-easemob v1.1.5

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

react-native-im-easemob

npm version Build Status

环信IM的原生接口React-Native封装库。

安装

使用Yarn安装:

yarn add react-native-im-easemob

使用npm安装:

npm install --save react-native-im-easemob

iOS环境设置

添加Podfile,类似如下格式:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

def common_target
    pod 'MJExtension', :git => 'https://github.com/RNCommon/MJExtension.git', :commit => 'cd3de71c4955935a762a46e59d90160991f5fa92'
    // React target and other common target...
end

target "MainTarget" do
    common_target
    pod 'Hyphenate', '= 3.6.2'
    pod 'react-native-im-easemob/Dev', :path => '../node_modules/react-native-im-easemob'
end

target "DeployTarget" do
    common_target
    pod 'HySDKDeploy', '= 3.6.2'
    pod 'react-native-im-easemob/Deploy', :path => '../node_modules/react-native-im-easemob'
end

其中MainTarget是真机和模拟器通用的部署Target,主要用于调试。DeployTarget是只支持armv7和arm64的Target,主要用于打包发布。

这是因为环信SDK的原因,Hyphenate打包需要使用lipo来处理Hyphenate.framework,从中剔除i386和x86_64的模拟器框架。具体原因请参照环信文档。

Android环境设置

在settings.gradle文件中添加:

include ':react-native-im-easemob'
project(':react-native-im-easemob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-im-easemob/android')

在module级的build.gradle中添加:

dependencies {
    implementation project(':react-native-im-easemob')
}

在ReactNativeHost中添加:

import com.im.easemob.EasemobPackage;

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new EasemobPackage()
    );
}

Android离线推送接收消息,需要配置appId和appKey或者appId和AappSecret (不同的手机需要配置的不一样,具体参考环信文档:http://docs-im.easemob.com/im/android/push/thirdpartypush) 在主工程中的AndroidManifest.xml中配置appId和appKey或者appId和AappSecret

 <!-- start  离线推送配置appId和appSecret(小米,oppo,meizu)-->
        <meta-data
            android:name="IM_EASEMOB_XIAOMI_PUSH_APP_ID"
            android:value="替换成你自己申请的小米APP_ID" />
        <meta-data
            android:name="IM_EASEMOB_XIAOMI_PUSH_APP_KEY"
            android:value="替换成你自己申请的小米APP_KEY" />

        <meta-data
            android:name="IM_EASEMOB_OPPO_PUSH_APP_KEY"
            android:value="替换成你自己申请的OPPO的APP_KEY" />
        <meta-data
            android:name="IM_EASEMOB_OPPO_PUSH_APP_SECRET"
            android:value="替换成你自己申请的OPPO的APP_SECRET" />

        <meta-data
            android:name="IM_EASEMOB_MEIZU_PUSH_APP_ID"
            android:value="替换成你自己申请的魅族的APP_ID" />
        <meta-data
            android:name="IM_EASEMOB_MEIZU_PUSH_APP_KEY"
            android:value="替换成你自己申请的魅族的APP_KEY" />
        <!--end      离线推送配置appId和appSecret(小米,oppo,meizu)-->
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

4 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago