android.intent.action.view 融云,Android集成融云单聊

第一步.

点击此处下载

52e8b105992ac664a485d92b3f443c22.png

第二步

新建自己的Demo,导入IMKit和IMLib两个Module,添加依赖

4d62e7b9c8f8585330a0a52d5e7c023d.png

第三步.

初始化,并在清单文件中进行配置

public class App extends Application {

@Override

public void onCreate() {

super.onCreate();

//初始化

RongIM.init(this);

//token值

String token1 ="sTltJPOv/r0kihB1hmeZvw8qgkkWdAJViRK14/KzM38yWaGUkIg8DC7v5YqATLjy5FEuJAiT0K0+Gn1XxPU3UQ==";

//连接融云

RongIM.connect(token1, new RongIMClient.ConnectCallback() {

@Override

public void onTokenIncorrect() {

}

@Override

public void onSuccess(String s) {

Log.d("app", "onTokenIncorrect: "+s);

}

@Override

public void onError(RongIMClient.ErrorCode errorCode) {

}

});

}

}

第四步

新建ConversationActivity,什么也不用写

它的布局

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:name="io.rong.imkit.fragment.ConversationFragment"

android:layout_width="match_parent"

android:layout_height="match_parent" />

LinearLayout>

第五步

新建ConversationListActivity,同样什么都不用写

它的布局

android:orientation="vertical" android:layout_width="match_parent"

android:layout_height="match_parent">

android:name="io.rong.imkit.fragment.ConversationListFragment"

android:layout_width="match_parent"

android:layout_height="match_parent" />

LinearLayout>

第六步

在需要调用聊天界面的地方写一行代码

public class MainActivity extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

RongIM.getInstance().startPrivateChat(MainActivity.this, "9527", "标题");

}

});

}

}

最重要的,开始进行配置

在IMLib的AndroidManifest.xml中

data

android:name="RONG_CLOUD_APP_KEY"

android:value="换成自己的APP key" />

在应用的 App Module 的 AndroidManifest.xml 文件中,添加 FileProvider 相关配置,修改 android:authorities 为 “您的应用的包名称.FileProvider”。

android:authorities="您的应用包名.FileProvider"

android:exported="false"

android:grantUriPermissions="true">

android:resource="@xml/rc_file_path" />

provider>

融云 SDK 是通过隐式调用的方式来实现界面跳转的。因此您需要在 AndroidManifest.xml 中,您的会话列表 Activity 下面配置 intent-filter,其中,android:host 是您应用的包名,需要手动修改,其他请保持不变。

android:screenOrientation="portrait"

android:windowSoftInputMode="stateHidden|adjustResize">

android:pathPrefix="/conversationlist"

android:scheme="rong" />

intent-filter>

activity>

android:screenOrientation="portrait"

android:windowSoftInputMode="stateHidden|adjustResize">

android:pathPrefix="/conversation/"

android:scheme="rong" />

intent-filter>

activity>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值