IMLib supports dynamic AppKey switching starting from version 2.x:
-
Disconnect from RongCloud using
RongCoreClient.getInstance().disconnect();
This disconnects you from RongCloud but still lets you receive notifications for new messages. Use this to stay informed about new messages after disconnecting.If you don’t want to receive any push notifications after disconnecting, call
RongCoreClient.getInstance().logout();
This logs you out completely and internally callsdisconnect()
. -
Call
RongCoreClient.getInstance().switchAppKey("your_new_APP_KEY");
-
Call
RongCoreClient.init(context, APP_KEY, initOption);
with the new AppKey. -
Call
RongCoreClient.connect(token, callback)
with the Token corresponding to the new AppKey.