/// <summary>
        /// Initializes the ion instance.
        /// </summary>
        /// <returns>The async.</returns>
        protected async override Task <bool> OnPreInitAsync()
        {
            if (!await base.OnPreInitAsync())
            {
                return(false);
            }

            fileManager = new AndroidFileManager(context);

            var path = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "ION.database");

            database                  = new IONDatabase(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), path, this);
            deviceManager             = new BaseDeviceManager(this, new AndroidConnectionManager(this));
            locationManager           = new AndroidLocationManager(this);
            alarmManager              = new BaseAlarmManager(this);
            dataLogManager            = new DataLogManager(this);
            alarmManager.alertFactory = (IAlarmManager am, IAlarm alarm) => {
                return(new CompoundAlarmAlert(alarm,
                                              new PopupActivityAlert(alarm, context),
                                              new ToneAlarmAlert(alarm, this),
                                              new VibrateAlarmAlert(alarm, this)
                                              ));
            };

            fluidManager = new BaseFluidManager(this);

            return(true);
        }
        protected override void OnCreateManagers()
        {
            var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ION.database");

            fileManager           = new IosFileManager();
            database              = new IONDatabase(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(), path, this);
            locationManager       = new IosLocationManager(this);
            deviceManager         = new BaseDeviceManager(this, new IonCBCentralManagerDelegate(this));
            alarmManager          = new BaseAlarmManager(this);
            dataLogManager        = new DataLogManager(this);
            fluidManager          = new BaseFluidManager(this);
            manualSensorContainer = new ManualSensorContainer();

            alarmManager.alertFactory = (IAlarmManager am, IAlarm alarm) => {
                return(new CompoundAlarmAlert(alarm, new PopupWindowAlarmAlert(alarm), new VibrateAlarmAlert(alarm, this), new SoundAlarmAlert(alarm, this)));
            };
        }
Exemple #3
0
        // Overridden from BaseAndroidION
        protected async override Task <bool> OnPreInitAsync()
        {
            if (!await base.OnPreInitAsync())
            {
                return(false);
            }

            fileManager = new AndroidFileManager(context);

            var file = fileManager.CreateTemporaryFile("TEMPORARY_DATABASE.db", EFileAccessResponse.CreateIfMissing);

            database = new IONDatabase(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), file.fullPath, this);

            deviceManager             = new RemoteDeviceManager(this);
            locationManager           = new AndroidLocationManager(this);
            alarmManager              = new BaseAlarmManager(this);
            dataLogManager            = new DataLogManager(this);
            alarmManager.alertFactory = (IAlarmManager am, IAlarm alarm) => {
                return(new CompoundAlarmAlert(alarm, new PopupActivityAlert(alarm, context), new ToneAlarmAlert(alarm, this), new VibrateAlarmAlert(alarm, this)));
            };
            fluidManager = new BaseFluidManager(this);

            return(true);
        }