protected override void OnHandleIntent(Intent intent)
        {
            try
            {
                Console.WriteLine("Service Started");
                var containerFactory = new ContainerFactory();
                containerFactory.AddRegistrations(builder =>
                {
                    var androidRegistrations = new AndroidPlatformServicesRegistrator();
                    androidRegistrations.RegisterPlatformSpecificServices(builder);
                });

                var container    = containerFactory.Build();
                var synchronizer = container.Resolve <ISynchronizer>();

                var serverOnline = synchronizer.Synchronize().Result;
                Console.WriteLine($"Service Synchronization Finished - Result: {serverOnline}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 2
0
        public override void OnReceive(Context context, Intent intent)
        {
            Console.WriteLine($"Boot receiver started. Action: {intent.Action}");
            var containerFactory = new ContainerFactory();

            containerFactory.AddRegistrations(builder =>
            {
                var androidRegistrations = new AndroidPlatformServicesRegistrator();
                androidRegistrations.RegisterPlatformSpecificServices(builder);
            });

            var container            = containerFactory.Build();
            var configurationManager = container.Resolve <IMobileConfigurationReader>();

            if (configurationManager.GetConfiguration().AlreadyInitialized)
            {
                if (configurationManager.GetConfiguration().ApplicationMode == ApplicationMode.Client)
                {
                    var synchronizer = container.Resolve <ISynchronizationServiceManager>();
                    synchronizer.StartSynchronizationService();
                }
            }
        }