Beispiel #1
0
        public override async Task TextToSpeechAsync(string text)
        {
            AndroidTextToSpeech textToSpeech = new AndroidTextToSpeech();
            await textToSpeech.SpeakAsync(text);

            textToSpeech.Dispose();
        }
Beispiel #2
0
 public void SetService(AndroidSensusService service)
 {
     _service             = service;
     _connectivityManager = _service.GetSystemService(Context.ConnectivityService) as ConnectivityManager;
     _deviceId            = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId);
     _textToSpeech        = new AndroidTextToSpeech(_service);
     _wakeLock            = (_service.GetSystemService(Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS");
 }
 public override Task TextToSpeechAsync(string text)
 {
     return(Task.Run(async() =>
     {
         AndroidTextToSpeech textToSpeech = new AndroidTextToSpeech(_service);
         await textToSpeech.SpeakAsync(text);
         textToSpeech.Dispose();
     }));
 }
Beispiel #4
0
        public void SetService(AndroidSensusService service)
        {
            _service             = service;
            _connectivityManager = _service.GetSystemService(Context.ConnectivityService) as ConnectivityManager;
            _notificationManager = _service.GetSystemService(Context.NotificationService) as NotificationManager;
            _deviceId            = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId);
            _textToSpeech        = new AndroidTextToSpeech(_service);
            _wakeLock            = (_service.GetSystemService(Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS");

            // must initialize after _deviceId is set
            if (Insights.IsInitialized)
            {
                Insights.Identify(_deviceId, "Device ID", _deviceId);
            }
        }
        public void SetService(AndroidSensusService service)
        {
            _service = service;

            if (_service == null)
            {
                if (_connectivityManager != null)
                {
                    _connectivityManager.Dispose();
                    _connectivityManager = null;
                }

                if (_notificationManager != null)
                {
                    _notificationManager.Dispose();
                    _notificationManager = null;
                }

                if (_textToSpeech != null)
                {
                    _textToSpeech.Dispose();
                    _textToSpeech = null;
                }

                if (_wakeLock != null)
                {
                    _wakeLock.Dispose();
                    _wakeLock = null;
                }
            }
            else
            {
                _connectivityManager      = _service.GetSystemService(Context.ConnectivityService) as ConnectivityManager;
                _notificationManager      = _service.GetSystemService(Context.NotificationService) as NotificationManager;
                _textToSpeech             = new AndroidTextToSpeech(_service);
                _wakeLock                 = (_service.GetSystemService(Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS");
                _wakeLockAcquisitionCount = 0;
                _deviceId                 = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId);
            }
        }
        public void SetService(AndroidSensusService service)
        {
            _service = service;

            if (_service == null)
            {
                if (_connectivityManager != null)
                    _connectivityManager.Dispose();

                if (_notificationManager != null)
                    _notificationManager.Dispose();

                if (_textToSpeech != null)
                    _textToSpeech.Dispose();

                if (_wakeLock != null)
                    _wakeLock.Dispose();
            }
            else
            {
                _connectivityManager = _service.GetSystemService(Context.ConnectivityService) as ConnectivityManager;
                _notificationManager = _service.GetSystemService(Context.NotificationService) as NotificationManager;
                _textToSpeech = new AndroidTextToSpeech(_service);
                _wakeLock = (_service.GetSystemService(Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS");
                _wakeLockAcquisitionCount = 0;
                _deviceId = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId);

                // must initialize after _deviceId is set
                if (Insights.IsInitialized)
                    Insights.Identify(_deviceId, "Device ID", _deviceId);
            }
        }
 public void SetService(AndroidSensusService service)
 {
     _service = service;
     _connectivityManager = _service.GetSystemService(Context.ConnectivityService) as ConnectivityManager;
     _notificationManager = _service.GetSystemService(Context.NotificationService) as NotificationManager;
     _deviceId = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId);
     _textToSpeech = new AndroidTextToSpeech(_service);
     _wakeLock = (_service.GetSystemService(Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS");
 }