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

            _calls = new List<CTCall>();

            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
                {
                    // for some reason, using a single CTCallCenter misses calls when the app is resumed from
                    // background. if we use two CTCallCenters, the calls that occurred in the background
                    // are passed to the second CTCallCenter. more on this here:
                    //
                    // http://stackoverflow.com/questions/21195732/how-to-get-a-call-event-using-ctcallcentersetcalleventhandler-that-occurred-wh
                    //
                    // since all call activity is logged via the second call center, just use it to gather call data.

                    _callCenter1 = new CTCallCenter();
                    _callCenter1.CallEventHandler += call =>
                    {
                        lock (_calls)
                            if (!ContainsCall(call))
                                _calls.Add(call);
                    };

                    _callCenter2 = new CTCallCenter();
                    _callCenter2.CallEventHandler += call =>
                    {
                        lock (_calls)
                            if (!ContainsCall(call))
                                _calls.Add(call);
                    };
                });
        }
Example #2
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (callCenter == null)
            {
                callCenter = new CTCallCenter();
                callCenter.CallEventHandler += CallEndedEvent;
            }
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			this.Title = "Core Telephony Info";
			this.TableView.AllowsSelection = false;
			this.TableView.DataSource = new TableViewDataSource (this);
			
			networkInfo = new CTTelephonyNetworkInfo ();
			callCenter = new CTCallCenter ();
			callCenter.CallEventHandler += CallEvent;
			carrierName = networkInfo.SubscriberCellularProvider == null ? null : networkInfo.SubscriberCellularProvider.CarrierName;
			networkInfo.CellularProviderUpdatedEventHandler += ProviderUpdatedEvent;
		}
Example #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.Title = "Core Telephony Info";
            this.TableView.AllowsSelection = false;
            this.TableView.DataSource      = new TableViewDataSource(this);

            networkInfo = new CTTelephonyNetworkInfo();
            callCenter  = new CTCallCenter();
            callCenter.CallEventHandler += CallEvent;
            carrierName = networkInfo.SubscriberCellularProvider == null ? null : networkInfo.SubscriberCellularProvider.CarrierName;
            networkInfo.CellularProviderUpdatedEventHandler += ProviderUpdatedEvent;
        }
Example #5
0
        protected override void Initialize()
        {
            base.Initialize();

            _calls = new List <CTCall>();

            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                // for some reason, using a single CTCallCenter misses calls when the app is resumed from
                // background. if we use two CTCallCenters, the calls that occurred in the background
                // are passed to the second CTCallCenter. more on this here:
                //
                // http://stackoverflow.com/questions/21195732/how-to-get-a-call-event-using-ctcallcentersetcalleventhandler-that-occurred-wh
                //
                // since all call activity is logged via the second call center, just use it to gather call data.

                _callCenter1 = new CTCallCenter();
                _callCenter1.CallEventHandler += call =>
                {
                    lock (_calls)
                        if (!ContainsCall(call))
                        {
                            _calls.Add(call);
                        }
                };

                _callCenter2 = new CTCallCenter();
                _callCenter2.CallEventHandler += call =>
                {
                    lock (_calls)
                        if (!ContainsCall(call))
                        {
                            _calls.Add(call);
                        }
                };
            });
        }