All Projects → reactnativecomponent → React Native Netease Im

reactnativecomponent / React Native Netease Im

网易云信React Native组件

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to React Native Netease Im

Netty Websocket Spring Boot Starter
🚀 lightweight high-performance WebSocket framework ( 轻量级、高性能的WebSocket框架)
Stars: ✭ 885 (+333.82%)
Mutual labels:  chat, im
Srain
Modern IRC client written in GTK
Stars: ✭ 197 (-3.43%)
Mutual labels:  chat, im
Qtalk
Startalk is a high-performace IM software for business. It has been stably used in Qunar for more than 4 years, providing services as well as consultation after and before sales to business. Startalk is applicable to multiple scenarios, such as office automation, business services, and first-party SDKs for IM scenes
Stars: ✭ 980 (+380.39%)
Mutual labels:  chat, im
Ghchat
📱A chat application for GitHub. React + PWA + Node(koa2) + Typescripts + Mysql + Socket.io
Stars: ✭ 791 (+287.75%)
Mutual labels:  chat, im
Im service
golang im server
Stars: ✭ 1,694 (+730.39%)
Mutual labels:  chat, im
Ios Chat
开源的即时通讯(野火IM)系统
Stars: ✭ 867 (+325%)
Mutual labels:  chat, im
Gochat
goim server write by golang !🚀
Stars: ✭ 1,144 (+460.78%)
Mutual labels:  chat, im
React Native Chat Demo
网易云信IM示例
Stars: ✭ 325 (+59.31%)
Mutual labels:  chat, im
Android yichat lite
android client
Stars: ✭ 118 (-42.16%)
Mutual labels:  chat, im
Matrix Commander
simple but convenient CLI-based Matrix client app for sending and receiving
Stars: ✭ 90 (-55.88%)
Mutual labels:  chat, im
Inchat
一个轻量级、高效率的支持多端(应用与硬件Iot)的可分布式、异步网络应用通讯框架
Stars: ✭ 654 (+220.59%)
Mutual labels:  chat, im
Nettychat
基于Netty+TCP+Protobuf实现的Android IM库,包含Protobuf序列化、TCP拆包与粘包、长连接握手认证、心跳机制、断线重连机制、消息重发机制、读写超时机制、离线消息、线程池等功能。
Stars: ✭ 1,979 (+870.1%)
Mutual labels:  chat, im
Xz wechat
微信聊天框架搭建,高仿微信聊天框架,一步步学习聊天框架的搭建
Stars: ✭ 634 (+210.78%)
Mutual labels:  chat, im
Angular Chat
(IM App)Chat App built using Angular and Socket.io
Stars: ✭ 12 (-94.12%)
Mutual labels:  chat, im
Chatengine
Open source mtproto server written in golang with compatible telegram client
Stars: ✭ 544 (+166.67%)
Mutual labels:  chat, im
Easychatandroidclient
EasyChat是一个开源的社交类的App。主要包含消息、好友、群组等相关的IM核心功能。部分界面参照了QQ、微信等相关社交APP。EasyChat APP整体采用MVVM模式,基于JetPack(Lifecycle,LiveData,ViewModel,Room)构建
Stars: ✭ 64 (-68.63%)
Mutual labels:  chat, im
Hrlchatui
android自定义聊天界面 支持语音 图片 视频 文件布局的显示
Stars: ✭ 273 (+33.82%)
Mutual labels:  chat, im
Oim Fx
OIM是采用 Java平台开发的一套即时通讯聊天系统,献给对即时通讯有兴趣的朋友。服务端实现了TCP Socket和WebSocket。方便接入网页版、安卓、IOS、PC桌面版客户端。OIM已经实现桌面版客户端,可以跨平台Windows、mac、Linux使用,用于公司内网、外网通讯、客服系统等,聊天系统。OIM项目可用于任何商业、个人作品中并且希望能够保留作者信息。如果OIM能够帮助到您,请点赞好评,加个星
Stars: ✭ 324 (+58.82%)
Mutual labels:  chat, im
Uni Huanxin Im
💬 uniapp集成环信小程序sdk,实现多端实时通讯
Stars: ✭ 84 (-58.82%)
Mutual labels:  chat, im
Hyperf Chat
Hyperf Chat
Stars: ✭ 139 (-31.86%)
Mutual labels:  chat, im

React Native的网易云信插件 欢迎加入QQ群交流153174456

Demo

react-native-chat-demo

注意事项:

2.普通帐号不要使用5位数,因为5位数设定是系统帐号,尽量使用6位或者6位以上

1.安装

  • 0.60以下请使用2.1.0版本

npm install react-native-netease-im 或者 yarn add react-native-netease-im 
cd ios
pod install

2.配置

2.1 android配置

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

multiDexEnabled true
manifestPlaceholders = [
	// 如果有多项,每一项之间需要用逗号分隔
    NIM_KEY: "云信的APPID"    //在此修改云信APPID
]

AndroidManifest.xml里,添加如下代码:

< manifest

    ......

    <!-- SDK 权限申明 -->
    <permission
        android:name="${applicationId}.permission.RECEIVE_MSG"
        android:protectionLevel="signature"/>
    <!-- 接收 SDK 消息广播权限 -->
    <uses-permission android:name="${applicationId}.permission.RECEIVE_MSG"/>

    ......
    < application
            ......
            <!-- 设置你的网易聊天App Key -->
     <meta-data android:name="com.netease.nim.appKey" android:value="${NIM_KEY}" />


android/app/src/main/java/<你的包名>/MainActivity.java

import com.netease.im.uikit.permission.MPermission;
import com.netease.im.RNNeteaseImModule;
import com.netease.im.ReceiverMsgParser;

public class MainActivity extends ReactActivity {

 ......

  @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         if(ReceiverMsgParser.checkOpen(getIntent())){//在后台时处理点击推送消息
             RNNeteaseImModule.launch = getIntent();
         }
     }

 @Override
 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        MPermission.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
 }

android/app/src/main/java/<你的包名>/MainApplication.java中添加如下两行:

...
import com.netease.im.RNNeteaseImPackage;
import com.netease.im.IMApplication;
import com.netease.im.ImPushConfig;

public class MainApplication extends Application implements ReactApplication {

  @Override
  public void onCreate() {
    // IMApplication.setDebugAble(BuildConfig.DEBUG);
    // 推送配置,没有可传null
     ImPushConfig config = new ImPushConfig();
    // 小米证书配置,没有可不填
    config.xmAppId = "";
    config.xmAppKey = "";
    config.xmCertificateName = "";
    // 华为推送配置,没有可不填
    config.hwCertificateName = "";
    IMApplication.init(this, MainActivity.class,R.drawable.ic_stat_notify_msg, config);
   ...
  }
}

2.2 ios配置

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

...
#import <NIMSDK/NIMSDK.h>
#import "NTESSDKConfigDelegate.h"
@interface AppDelegate ()
@property (nonatomic,strong) NTESSDKConfigDelegate *sdkConfigDelegate;
@end
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[self setupNIMSDK];
[self registerAPNs];
if (launchOptions) {//未启动时,点击推送消息
    NSDictionary * remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (remoteNotification) {
      [self performSelector:@selector(clickSendObserve:) withObject:remoteNotification afterDelay:0.5];
    }
  }
...
return YES;
}
- (void)clickSendObserve:(NSDictionary *)dict{
  [[NSNotificationCenter defaultCenter]postNotificationName:@"ObservePushNotification" object:@{@"dict":dict,@"type":@"launch"}];
}
- (void)setupNIMSDK
{
//在注册 NIMSDK appKey 之前先进行配置信息的注册,如是否使用新路径,是否要忽略某些通知,是否需要多端同步未读数
self.sdkConfigDelegate = [[NTESSDKConfigDelegate alloc] init];
[[NIMSDKConfig sharedConfig] setDelegate:self.sdkConfigDelegate];
[[NIMSDKConfig sharedConfig] setShouldSyncUnreadCount:YES];
//appkey 是应用的标识,不同应用之间的数据(用户、消息、群组等)是完全隔离的。
//注册APP,请将 NIMSDKAppKey 换成您自己申请的App Key
[[NIMSDK sharedSDK] registerWithAppID:@"appkey" cerName:@"证书名称"];
}

#pragma mark - misc
- (void)registerAPNs
{
[[UIApplication sharedApplication] registerForRemoteNotifications];
UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [[NIMSDK sharedSDK] updateApnsToken:deviceToken];
}
//在后台时处理点击推送消息
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{

  [[NSNotificationCenter defaultCenter]postNotificationName:@"ObservePushNotification" object:@{@"dict":userInfo,@"type":@"background"}];
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
  NSLog(@"fail to get apns token :%@",error);
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
  NSInteger count = [[[NIMSDK sharedSDK] conversationManager] allUnreadCount];
  [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
}

如何使用

引入包

import {NimSession} from 'react-native-netease-im';

API

参考index.js

监听会话

NativeAppEventEmitter.addListener("observeRecentContact",(data)=>{
  console.log(data); //返回会话列表和未读数
});

推送(推送配置参考官方文档即可)

//程序运行时获取的推送点击事件
NativeAppEventEmitter.addListener("observeLaunchPushEvent",(data)=>{
  console.log(data);
});
//程序后台时获取的推送点击事件
NativeAppEventEmitter.addListener("observeBackgroundPushEvent",(data)=>{
  console.log(data); 
});
//推送数据格式
{
    ...
    sessionBody:{
        sessionId:"",
        sessionType:"",
        sessionName:""
    }
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].