Skip to content

Commit 4267c12

Browse files
committed
2 parents 3577782 + cc15277 commit 4267c12

File tree

10 files changed

+21
-15
lines changed

10 files changed

+21
-15
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ React Native的网易云信插件
55
[react-native-chat-demo](https://github.com/reactnativecomponent/react-native-chat-demo)
66

77
#### 注意事项:
8-
9-
##### 1.react-native版本需要0.47.0及以上NIMSDK对应版本4.7.0
10-
118
##### 2.普通帐号不要使用5位数,因为5位数设定是系统帐号,尽量使用6位或者6位以上
129

1310
## 如何安装
@@ -117,11 +114,8 @@ public class MainApplication extends Application implements ReactApplication {
117114
#### iOS配置
118115
install with CocoaPods
119116
```
120-
pod 'NIMSDK', '4.9.0'
121-
pod 'SSZipArchive', '~> 1.2'
122-
pod 'Reachability', '~> 3.1.1'
117+
pod 'NIMSDK', '5.6.0'
123118
pod 'CocoaLumberjack', '~> 2.0.0-rc2'
124-
pod 'FMDB', '~>2.5'
125119
```
126120
Run `pod install`
127121

@@ -197,10 +191,13 @@ UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTy
197191
```
198192

199193
#### Android配置
200-
201194
`android/app/build.gradle`里,defaultConfig栏目下添加如下代码:
202-
203-
195+
```
196+
manifestPlaceholders = [
197+
// 如果有多项,每一项之间需要用逗号分隔
198+
NIM_KEY: "云信的APPID" //在此修改云信APPID
199+
]
200+
```
204201
`AndroidManifest.xml`里,添加如下代码:
205202
```
206203
< manifest

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-slate

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ android {
44
useLibrary 'org.apache.http.legacy'
55

66
compileSdkVersion 23
7-
buildToolsVersion "23.0.1"
7+
// buildToolsVersion "23.0.1"
88

99
defaultConfig {
1010
minSdkVersion 16
667 KB
Binary file not shown.

android/libs/mi_push_sdk_3.2.2.jar

-585 KB
Binary file not shown.

android/libs/nim-basesdk-4.7.3.jar

-871 KB
Binary file not shown.

android/libs/nim-basesdk-6.1.2.jar

1.02 MB
Binary file not shown.

android/libs/nim-push-6.1.2.jar

54.2 KB
Binary file not shown.

android/src/main/AndroidManifest.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<application>
3737

3838
<!--适配 Android O 版本后台运行机制-->
39+
<!-- 网易云通信进程间通信service -->
3940
<service android:name="com.netease.nimlib.service.ResponseService" />
4041
<!-- 声明网易云通信后台服务,如需保持后台推送,使用独立进程效果会更好。 -->
4142
<service
@@ -69,9 +70,6 @@
6970
<!-- 网易云通信进程间通信 Receiver -->
7071
<receiver android:name="com.netease.nimlib.service.ResponseReceiver" />
7172

72-
<!-- 网易云通信进程间通信service -->
73-
<service android:name="com.netease.nimlib.service.ResponseService" />
74-
7573
<!-- 安卓保活配置 -->
7674
<service
7775
android:name="com.netease.cosine.core.CosineService"
@@ -146,6 +144,11 @@
146144
<category android:name="android.intent.category.DEFAULT"/>
147145
</intent-filter>
148146
</receiver>
147+
<provider
148+
android:name="com.netease.nimlib.ipc.NIMContentProvider"
149+
android:authorities="${applicationId}.ipc.provider"
150+
android:exported="false"
151+
android:process=":core" />
149152
</application>
150153
</manifest>
151154

android/src/main/java/com/netease/im/IMApplication.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.netease.nimlib.sdk.SDKOptions;
3333
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
3434
import com.netease.nimlib.sdk.auth.LoginInfo;
35+
import com.netease.nimlib.sdk.mixpush.MixPushConfig;
3536
import com.netease.nimlib.sdk.mixpush.MixPushService;
3637
import com.netease.nimlib.sdk.mixpush.NIMPushClient;
3738
import com.netease.nimlib.sdk.msg.MessageNotifierCustomization;
@@ -93,7 +94,11 @@ public static void init(Context context, Class mainActivityClass, @DrawableRes i
9394

9495
// 注册小米推送appID 、appKey 以及在云信管理后台添加的小米推送证书名称,该逻辑放在 NIMClient init 之前
9596
if (miPushConfig != null) {
96-
NIMPushClient.registerMiPush(context, miPushConfig.certificate, miPushConfig.appID, miPushConfig.appKey);
97+
MixPushConfig mixPushConfig = new MixPushConfig();
98+
mixPushConfig.xmCertificateName = miPushConfig.certificate;
99+
mixPushConfig.xmAppId = miPushConfig.appID;
100+
mixPushConfig.xmAppKey = miPushConfig.appKey;
101+
NIMPushClient.initPush(new MixPushConfig());
97102
}
98103

99104
NIMClient.init(context, getLoginInfo(), getOptions(context));

0 commit comments

Comments
 (0)