Dynamic AppKey switching

IMLib supports dynamic AppKey switching starting from version 2.x:

  1. 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 calls disconnect().

  2. Call RongCoreClient.getInstance().switchAppKey("your_new_APP_KEY");

  3. Call RongCoreClient.init(context, APP_KEY, initOption); with the new AppKey.

  4. Call RongCoreClient.connect(token, callback) with the Token corresponding to the new AppKey.