/// <summary> /// Initializes Mobile core for Android using custom assembly for storing resources. Best to be used with Xamarin.Forms. /// Resources needs to be stored in ./Resources directory of Xamarin.Forms platform-independent project. /// </summary> /// <param name="assembly">Assembly of the platform-independent project</param> /// <param name="appContext">Android application contextt</param> /// <param name="options">additional initialization options</param> public static void Init(Assembly assembly, Context appContext, Options options) { IPlatformInjector platformInjector = new AndroidPlatformInjector(appContext); platformInjector.ExecutingAssembly = assembly; MobileCore.Init(platformInjector, options); }
/// <summary> /// Initializes Mobile core for iOS using custom assembly for storing resources. Best to be used with Xamarin.Forms. /// Resources needs to be stored in ./Resources directory of Xamarin.Forms platform-independent project. /// </summary> /// <param name="assembly">Assembly of the platform-independent project</param> /// <param name="options">additional initialization options</param> public static MobileCore Init(Assembly assembly, Options options) { IPlatformInjector platformInjector = new IOSPlatformInjector(); platformInjector.ExecutingAssembly = assembly; return(MobileCore.Init(platformInjector, options)); }
/// <summary> /// Called when mobile core instance needs to be destroyed. /// </summary> public void Destroy() { foreach (var serviceModule in serviceInstanceCache.GetAllCachedServices()) { serviceModule.Destroy(); } instance = null; }
/// <summary> /// Called when mobile core instance needs to be destroyed. /// </summary> public void Destroy() { foreach (var serviceModule in services.Values) { serviceModule.Destroy(); } instance = null; }
/// <summary> /// Initializes MobileCore with specific options and with platform-specific injector. /// </summary> /// <param name="injector">platform specific implementation dependency injection module</param> /// <param name="options">initialization options</param> /// <returns>MobileCore singleton instance</returns> public static MobileCore Init(IPlatformInjector injector, Options options) { if (instance != null) { return(instance); } NonNull <Options>(options, "init options"); instance = new MobileCore(injector, options); try { sendAppAndDeviceMetrics(); } catch (System.Exception e) { MobileCore.Instance.Logger.Debug(String.Format("Error publishing device metrics: {0}", e.Message)); } return(instance); }
/// <summary> /// Initializes MobileCore with specific options and with platform-specific injector. /// </summary> /// <param name="injector">platform specific implementation dependency injection module</param> /// <param name="options">initialization options</param> /// <returns>MobileCore singleton instance</returns> public static MobileCore Init(IPlatformInjector injector, Options options) { NonNull <Options>(options, "init options"); instance = new MobileCore(injector, options); return(instance); }
/// <summary> /// Initializes MobileCore with specific options and with platform-specific injector. /// </summary> /// <param name="injector">platform specific implementation dependency injection module</param> /// <param name="options">initialization options</param> /// <returns>MobileCore singleton instance</returns> public static MobileCore Init(IPlatformInjector injector, Options options) { Contract.Requires(options != null); instance = new MobileCore(injector, options); return(instance); }