/// <summary> /// Method that is called to signal start of service. /// </summary> /// <param name="channelGroup">The channel group to which the channel should be added</param> /// <param name="appSecret">The app secret of the current application</param> public virtual void OnChannelGroupReady(IChannelGroup channelGroup, string appSecret) { lock (_serviceLock) { ChannelGroup = channelGroup; Channel = channelGroup.AddChannel(ChannelName, TriggerCount, TriggerInterval, TriggerMaxParallelRequests); var enabled = MobileCenter.Enabled && InstanceEnabled; _applicationSettings[EnabledPreferenceKey] = enabled; Channel.SetEnabled(enabled); } }
/// <summary> /// Method that is called to signal start of service. /// </summary> /// <param name="channelGroup">The channel group to which the channel should be added</param> /// <param name="appSecret">The app secret of the current application</param> public virtual void OnChannelGroupReady(IChannelGroup channelGroup, string appSecret) { if (channelGroup == null) { throw new ArgumentNullException(nameof(channelGroup)); } lock (_serviceLock) { ChannelGroup = channelGroup; Channel = channelGroup.AddChannel(ChannelName, TriggerCount, TriggerInterval, TriggerMaxParallelRequests); Channel.SetEnabled(InstanceEnabled); } }
/// <summary> /// Method that is called to signal start of service. /// </summary> /// <param name="channelGroup">The channel group to which the channel should be added</param> /// <param name="appSecret">The app secret of the current application</param> public virtual void OnChannelGroupReady(IChannelGroup channelGroup, string appSecret) { if (channelGroup == null) { throw new ArgumentNullException(nameof(channelGroup)); } lock (_serviceLock) { ChannelGroup = channelGroup; Channel = channelGroup.AddChannel(ChannelName, TriggerCount, TriggerInterval, TriggerMaxParallelRequests); var enabled = AppCenter.IsEnabledAsync().Result&& InstanceEnabled; ApplicationSettings.SetValue(EnabledPreferenceKey, enabled); Channel.SetEnabled(enabled); } }
// Internal for testing internal void InstanceConfigure(string appSecretOrSecrets) { if (_instanceConfigured) { AppCenterLog.Warn(AppCenterLog.LogTag, "App 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. _networkStateAdapter = new NetworkStateAdapter(); _channelGroup = _channelGroupFactory?.CreateChannelGroup(_appSecret) ?? new ChannelGroup(_appSecret, null, _networkStateAdapter); _channel = _channelGroup.AddChannel(ChannelName, Constants.DefaultTriggerCount, Constants.DefaultTriggerInterval, Constants.DefaultTriggerMaxParallelRequests); if (_logUrl != null) { _channelGroup.SetLogUrl(_logUrl); } _instanceConfigured = true; AppCenterLog.Assert(AppCenterLog.LogTag, "App Center SDK configured successfully."); }
// 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."); }