/// <summary> /// Initialize KiiSDK appID, appKey, deviceID, serverUrl and KiiHttpClientFactory. /// </summary> /// <remarks> /// This method is intended for use in internal purposes. Do not use it to initialize your application. /// </remarks> /// <param name='appId'> /// Application ID found in your Kii developer console /// </param> /// <param name='appKey'> /// Application key found in your Kii developer console /// </param> /// <param name='serverUrl'> /// Server URL. /// </param> /// <param name='syncFactory'> /// Http client factory for blocking api. /// </param> /// <param name='asyncFactory'> /// Http client factory for non-blocking api. /// </param> /// <exception cref='ArgumentException'> /// Is thrown when an argument passed to a method is invalid. /// </exception> public static void Initialize(string appId, string appKey, string serverUrl, KiiHttpClientFactory syncFactory, KiiHttpClientFactory asyncFactory) { if (Utils.IsEmpty(serverUrl)) { throw new ArgumentException(ErrorInfo.KII_SERVER_URL_IS_NULL); } if (!Uri.IsWellFormedUriString(serverUrl, UriKind.Absolute)) { throw new ArgumentException(ErrorInfo.KII_INVALID_SERVER_URL); } if (INSTANCE != null && Kii.AppId == appId && Kii.AppKey == appKey && Kii.BaseUrl == serverUrl) { return; } KiiCloudEngine.ClearAccessToken(); INSTANCE = new Kii(appId, appKey); INSTANCE.mBaseURL = serverUrl; INSTANCE.mKiiAppsBaseURL = CreateKiiAppsBaseURL(appId, serverUrl); INSTANCE.clientFactory = syncFactory; INSTANCE.asyncClientFactory = asyncFactory; }
internal static void LogOut() { Utils.CheckInitialize(false); CurrentUser = null; KiiCloudEngine.ClearAccessToken(); }