Example #1
0
        protected override void OnResume()
        {
            base.OnResume();

            FakeSessionDelete = new FakeSessionDelete();
            database          = new SQLiteRepository();
            userRepo          = new UserRepository(database);
            contactRepo       = new ContactRepository(database);
            configRepo        = new ConfigRepository(database);
            database.CreateDatabase();

            loginService   = new LoginService();
            contactService = new ContactService();
            errorText      = new ErrorText();

            if (_continue)
            {
                speechReco = SpeechRecognizer.CreateSpeechRecognizer(this.ApplicationContext);
                speechReco.SetRecognitionListener(this);
                intentReco = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                intentReco.PutExtra(RecognizerIntent.ExtraLanguagePreference, "es");
                intentReco.PutExtra(RecognizerIntent.ExtraCallingPackage, this.PackageName);
                intentReco.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelWebSearch);
                intentReco.PutExtra(RecognizerIntent.ExtraMaxResults, 1);

                toSpeech = new TextToSpeech(this, this);
            }
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            database          = new SQLiteRepository();
            configRepo        = new ConfigRepository(database);
            loginService      = new LoginService();
            errorText         = new ErrorText();
            FakeSessionDelete = new FakeSessionDelete();
            configuracion     = configRepo.GetConfig();

            b      = FindViewById <ImageButton>(Resource.Id.Enviar);
            b2     = FindViewById <ImageButton>(Resource.Id.Leer);
            b3     = FindViewById <ImageButton>(Resource.Id.Contactos);
            b4     = FindViewById <ImageButton>(Resource.Id.Configuracion);
            logout = FindViewById <Button>(Resource.Id.logout);

            try
            {
                client = loginService.Connect();
            }
            catch (Exception ex)
            {
                this.FinishAffinity();
            }

            if (client.IsUserAuthorized())
            {
                usuario = client.Session.TLUser;
            }

            service = new Intent(this, typeof(ReceiveService));
            if (!IsMyServiceRunning(service))
            {
                StartService(service);
            }

            SetVisible(true);
        }