Beispiel #1
0
        /// <summary>
        /// Steps required in the creation of the mobile app.
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            AppCenter.Start("INSERT_APP_CENTER_API_KEY",
                            typeof(Analytics), typeof(Crashes));

            Instance          = this;
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            LoadApplication(new App());
            PhoneRinging = false;


            this.notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);
            audioManager             = (Android.Media.AudioManager)GetSystemService(Context.AudioService);
            actionHandler            = new ActionHandler(
                new AudioManager(audioManager),
                new CallManager(),
                new GPSManager(),
                new NotificationManagerWrapper(notificationManager),
                new SmsManagerWrapper(SmsManager.Default));
            StartListening();


            IOktaStateManager state = await OktaContext.Current.SignInAsync();
        }
Beispiel #2
0
        public void sesBilgileri()
        {
            string ZIL_SESI      = "";
            string MEDYA_SESI    = "";
            string BILDIRIM_SESI = "";

            mgr = (Android.Media.AudioManager)GetSystemService(AudioService);
            //Zil sesi
            int max           = mgr.GetStreamMaxVolume(Android.Media.Stream.Ring);
            int suankiZilSesi = mgr.GetStreamVolume(Android.Media.Stream.Ring);

            ZIL_SESI = suankiZilSesi.ToString() + "/" + max.ToString();
            //Medya
            int maxMedya    = mgr.GetStreamMaxVolume(Android.Media.Stream.Music);
            int suankiMedya = mgr.GetStreamVolume(Android.Media.Stream.Music);

            MEDYA_SESI = suankiMedya.ToString() + "/" + maxMedya.ToString();
            //Bildirim Sesi
            int maxBildirim    = mgr.GetStreamMaxVolume(Android.Media.Stream.Notification);
            int suankiBildirim = mgr.GetStreamVolume(Android.Media.Stream.Notification);

            BILDIRIM_SESI = suankiBildirim.ToString() + "/" + maxBildirim.ToString();

            string gonderilecekler = ZIL_SESI + "=" + MEDYA_SESI + "=" + BILDIRIM_SESI + "=";

            byte[] git_Artik_bezdim = Encoding.UTF8.GetBytes("SESBILGILERI|" + gonderilecekler);
            PictureCallback.Send(Soketimiz, git_Artik_bezdim, 0, git_Artik_bezdim.Length, 59999);
        }
Beispiel #3
0
        public void SpeakText(string text)
        {
            toSpeak = text;

            if (speaker == null)
            {
                Android.Media.AudioManager am = (Android.Media.AudioManager)Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity.GetSystemService(Android.Content.Context.AudioService);
                int amStreamMusicMaxVol       = am.GetStreamMaxVolume(Android.Media.Stream.Music);
                am.SetStreamVolume(Android.Media.Stream.Music, amStreamMusicMaxVol, 0);
                speaker = new Android.Speech.Tts.TextToSpeech(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity, this);
            }
            else
            {
                SpeakRoute(toSpeak);
            }
        }
Beispiel #4
0
            public void OnSensorChanged(SensorEvent e)
            {
                Android.Media.AudioManager audioManager = currentContext.GetSystemService(AudioService) as Android.Media.AudioManager;

                try
                {
                    if (audioManager.BluetoothA2dpOn || audioManager.WiredHeadsetOn)
                    {
                        return;
                    }

                    if (mAdapter.MediaPlayer.IsPlaying)
                    {
                        float distance = e.Values[0];
                        if (distance >= currentSensor.MaximumRange)
                        {
                            mAdapter.SetAudioPlayByEarPhone(0);
                            SetScreenOn();
                        }
                        else
                        {
                            mAdapter.SetAudioPlayByEarPhone(2);
                            ViewHolderController.Instance.ReplayVoice();
                            SetScreenOff();
                        }
                    }
                    else
                    {
                        if (currentWakeLock != null && currentWakeLock.IsHeld)
                        {
                            currentWakeLock.Release();
                            currentWakeLock = null;
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    Toast.MakeText(currentContext, "Error:" + ex.Message, ToastLength.Short).Show();
                }
            }
Beispiel #5
0
 public AudioManager(Android.Media.AudioManager audioManager)
 {
     this.audioManager = audioManager;
 }