/// <summary> /// Initialize the SDK with the list of services to start. /// This may be called only once per application process lifetime. /// </summary> /// <param name="appSecret">A unique and secret key used to identify the application.</param> /// <param name="services">List of services to use.</param> public static void Start(string appSecret, params Type[] services) { string parsedSecret; try { parsedSecret = GetSecretForPlatform(appSecret, PlatformIdentifier); } catch (ArgumentException ex) { MobileCenterLog.Assert(MobileCenterLog.LogTag, ex.Message); return; } AndroidMobileCenter.Start(SetWrapperSdkAndGetApplication(), parsedSecret, GetServices(services)); }
static void PlatformStart(string appSecret, params Type[] services) { SetWrapperSdk(); string parsedSecret; try { parsedSecret = GetSecretForPlatform(appSecret, PlatformIdentifier); } catch (MobileCenterException ex) { MobileCenterLog.Assert(MobileCenterLog.LogTag, ex.Message); return; } iOSMobileCenter.Start(parsedSecret, GetServices(services)); }
// Internal for testing internal void InstanceConfigure(string appSecretOrSecrets) { if (_instanceConfigured) { MobileCenterLog.Warn(MobileCenterLog.LogTag, "Mobile Center may only be configured once."); return; } _appSecret = GetSecretForPlatform(appSecretOrSecrets, PlatformIdentifier); // If a factory has been supplied, use it to construct the channel group - this is designed for testing. // Normal scenarios will use new ChannelGroup(string). _channelGroup = _channelGroupFactory?.CreateChannelGroup(_appSecret) ?? new ChannelGroup(_appSecret); ApplicationLifecycleHelper.Instance.UnhandledExceptionOccurred += (sender, e) => _channelGroup.ShutdownAsync(); _channel = _channelGroup.AddChannel(ChannelName, Constants.DefaultTriggerCount, Constants.DefaultTriggerInterval, Constants.DefaultTriggerMaxParallelRequests); if (_logUrl != null) { _channelGroup.SetLogUrl(_logUrl); } _instanceConfigured = true; MobileCenterLog.Assert(MobileCenterLog.LogTag, "Mobile Center SDK configured successfully."); }