public static void Init(Application androidApp, IStartup startup = null, Action <IServiceCollection> platformBuild = null) { var callbacks = new ActivityLifecycleCallbacks(); androidApp.RegisterActivityLifecycleCallbacks(callbacks); var context = new AndroidContext(androidApp, callbacks); InitPlatform( startup, services => { services.AddSingleton(context); services.AddSingleton <IEnvironment, EnvironmentImpl>(); services.AddSingleton <IConnectivity, ConnectivityImpl>(); services.AddSingleton <IPowerManager, PowerManagerImpl>(); services.AddSingleton <IJobManager, JobManager>(); services.AddSingleton <IRepository, FileSystemRepositoryImpl>(); services.AddSingleton <IFileSystem, FileSystemImpl>(); services.AddSingleton <ISerializer, JsonNetSerializer>(); services.AddSingleton <ISettings, SettingsImpl>(); platformBuild?.Invoke(services); } ); }
internal static int GetResourceIdByName(this AndroidContext context, string iconName) => context .AppContext .Resources .GetIdentifier( iconName, "drawable", context.AppContext.PackageName );
internal static int GetColorByName(this AndroidContext context, string colorName) => context .AppContext .Resources .GetIdentifier( colorName, "color", context.AppContext.PackageName );
public static bool IsAtLeastAndroid10(this AndroidContext context) => context.IsMinApiLevel(29);
public EnvironmentImpl(AndroidContext context) => this.context = context;
public AndroidSqliteDatabase(AndroidContext context) : base(context.AppContext, "shinystore.db", null, 1) { }