/// <summary> /// Use this method if you plan to use background monitoring (works for ranging as well) /// </summary> /// <typeparam name="T"></typeparam> /// <param name="services"></param> /// <returns></returns> public static bool UseBeaconMonitoring <T>(this IServiceCollection services, BeaconMonitorConfig config) where T : class, IBeaconMonitorDelegate => services.UseBeaconMonitoring(typeof(T), config);
/// <summary> /// Use this method if you plan to use background monitoring (works for ranging as well) /// </summary> /// <param name="services"></param> /// <param name="delegateType"></param> /// <returns></returns> public static bool UseBeaconMonitoring(this IServiceCollection services, Type delegateType, BeaconMonitorConfig config) { #if NETSTANDARD return(false); #else if (delegateType == null) { throw new ArgumentException("You can't register monitoring regions without a delegate type"); } #if __ANDROID__ || WINDOWS_UWP services.AddSingleton(config); services.TryAddSingleton <BackgroundTask>(); services.UseBleClient(); services.UseNotifications(); #endif services.AddSingleton(typeof(IBeaconMonitorDelegate), delegateType); services.TryAddSingleton <IBeaconMonitoringManager, BeaconMonitoringManager>(); return(true); #endif }