コード例 #1
0
ファイル: MainActivity.cs プロジェクト: nodoid/AndroidBeacons
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            textUUID       = FindViewById <TextView>(Resource.Id.textUUID);
            textProximity  = FindViewById <TextView>(Resource.Id.textProximity);
            textDistance   = FindViewById <TextView>(Resource.Id.textDistance);
            textMajor      = FindViewById <TextView>(Resource.Id.textMajor);
            textMinor      = FindViewById <TextView>(Resource.Id.textMinor);
            textMessage    = FindViewById <TextView>(Resource.Id.textMessage);
            textNumberSeen = FindViewById <TextView>(Resource.Id.textNumberSeen);
            textStatus     = FindViewById <TextView>(Resource.Id.textStatus);
            textInRange    = FindViewById <TextView>(Resource.Id.textInRange);

            textUUID.Text = textProximity.Text = textMajor.Text = textMinor.Text = textMessage.Text = "";

            var btAdapter = BluetoothAdapter.DefaultAdapter;

            if (btAdapter.IsEnabled)
            {
                textStatus.SetTextColor(Android.Graphics.Color.AliceBlue);
                textStatus.Text = "Searching";
            }
            else
            {
                textStatus.SetTextColor(Android.Graphics.Color.Red);
                textStatus.Text = "Bluetooth not enabled";
            }

            beaconManager.Bind(this);

            monitorNotifier.EnterRegionComplete           += EnterRegion;
            monitorNotifier.ExitRegionComplete            += ExitRegion;
            rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #2
0
        public BeaconManager(Activity activity)
        {
            beaconsToStart = new List<Beacon>();

            this.activity = activity;

            beaconManager = IBeaconManager.GetInstanceForApplication(activity);
            beaconManager.Bind(this);
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _iBeaconManager.Bind(this);

            _monitorNotifier.EnterRegionComplete += EnteredRegion;
            _monitorNotifier.ExitRegionComplete  += ExitedRegion;

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;

            _destination = Intent.GetStringExtra("destination");
        }
コード例 #4
0
ファイル: MainActivity.cs プロジェクト: stefanradziuk/3nav
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Forms.Init(this, savedInstanceState);
            CarouselViewRenderer.Init();
            beaconMgr.Bind(this);
            SetSensorManager();
            Android.Graphics.Color barColor = Android.Graphics.Color.ParseColor("#191A2F");
            Window.SetStatusBarColor(barColor);
            LoadApplication(new App());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ARArt.Android.BeaconLocaterAndroid"/> class.
 /// </summary>
 public BeaconLocaterAndroid()
 {
     beacons          = new List <BeaconItem>();
     context          = Xamarin.Forms.Forms.Context;
     iBeaconManager   = IBeaconManager.GetInstanceForApplication(context);
     monitorNotifier  = new MonitorNotifier();
     rangeNotifier    = new RangeNotifier();
     monitoringRegion = new Region(beaconId, uuid, null, null);
     rangingRegion    = new Region(beaconId, uuid, null, null);
     iBeaconManager.Bind(this);
     rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
 }
コード例 #6
0
ファイル: iBeacon.cs プロジェクト: JohnGavilan/IBeaconDemo
        public void Bind(IBeaconConsumer ibeaconconsumer)
        {
            beaconMgr = IBeaconManager.GetInstanceForApplication((Context)ibeaconconsumer);
            beaconMgr.Bind(ibeaconconsumer);

            monitorNotifier = new MonitorNotifier();
            monitorNotifier.EnterRegionComplete += EnteredRegionHandler;
            monitorNotifier.ExitRegionComplete += ExitedRegionHandler;

            rangeNotifier = new RangeNotifier();
            rangeNotifier.DidRangeBeaconsInRegionComplete += EnteredRangeHandler;
        }
コード例 #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Dashboard);

            dashboard         = FindViewById <LinearLayout>(Resource.Id.dashboardLayout);
            trackButton       = FindViewById <Button>(Resource.Id.track);
            trackingTextView  = FindViewById <TextView>(Resource.Id.tracking_text);
            progressImageView = FindViewById <ImageView>(Resource.Id.progressImage);

            trackButton.Enabled = false;

            iBeaconManager.Bind(this);
        }
コード例 #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            beaconStatusLabel = FindViewById <TextView> (Resource.Id.beaconStatusLabel);

            beaconMgr.Bind(this);

            monitorNotifier.EnterRegionComplete += EnteredRegion;
            monitorNotifier.ExitRegionComplete  += ExitedRegion;

            rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            _view = FindViewById <RelativeLayout>(Resource.Id.findTheMonkeyView);
            _text = FindViewById <TextView>(Resource.Id.monkeyStatusLabel);

            _iBeaconManager.Bind(this);

            _monitorNotifier.EnterRegionComplete += EnteredRegion;
            _monitorNotifier.ExitRegionComplete  += ExitedRegion;

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #10
0
ファイル: MainService.cs プロジェクト: halukmy/GlassBeacon
        public override void OnCreate()
        {
            base.OnCreate ();

            _iBeaconManager = IBeaconManager.GetInstanceForApplication (this);

            _iBeaconManager.SetForegroundScanPeriod (2000);
            _iBeaconManager.SetForegroundBetweenScanPeriod (2500);

            _rangeNotifier = new RangeNotifier ();

            _rangingRegion = new Region (monkeyId, UUID, null, null);
            _iBeaconManager.Bind (this);

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #11
0
        public BeaconLocater()
        {
            beacons = new List <BeaconItem>();
            context = Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity;

            iBeaconManager  = IBeaconManager.GetInstanceForApplication(context);
            monitorNotifier = new MonitorNotifier();
            rangeNotifier   = new RangeNotifier();
            //DMI beacon UUId - b9407f30-f5f8-466e-aff9-25556b57fe6d
            monitoringRegion = new Region("ID", "6A1A7B3B-2B8C-6A4C-9A7C-0D1403107060", null, null);
            rangingRegion    = new Region("ID", "6A1A7B3B-2B8C-6A4C-9A7C-0D1403107060", null, null);

            iBeaconManager.Bind(this);

            rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #12
0
        public override void OnCreate()
        {
            base.OnCreate();

            _iBeaconManager = IBeaconManager.GetInstanceForApplication(this);

            _iBeaconManager.SetForegroundScanPeriod(2000);
            _iBeaconManager.SetForegroundBetweenScanPeriod(2500);

            _rangeNotifier = new RangeNotifier();

            _rangingRegion = new Region(monkeyId, UUID, null, null);
            _iBeaconManager.Bind(this);

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Init(this, bundle);

            _mainPage = (MainPage)App.GetMainPage();

            SetPage(_mainPage);

            beaconMgr.Bind(this);

            monitorNotifier.EnterRegionComplete += EnteredRegion;
            monitorNotifier.ExitRegionComplete  += ExitedRegion;

            rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            view            = FindViewById <RelativeLayout>(Resource.Id.findTheTokenView);
            textViewMessage = FindViewById <TextView>(Resource.Id.tokenStatusLabel);

            iBeaconManager.Bind(this);

            monitorNotifier.EnterRegionComplete += EnteredRegion;
            monitorNotifier.ExitRegionComplete  += ExitedRegion;

            rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;

            SwitchOnBT();
        }
コード例 #15
0
ファイル: MainActivity.cs プロジェクト: praveenkrjha/HackApp
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            AndroidEnvironment.UnhandledExceptionRaiser += HandleAndroidException;
            base.OnCreate(savedInstanceState);
            Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);
            RequestPermissions(PermissionsLocation, RequestLocationId);

            _iBeaconManager.Bind(this);

            _monitorNotifier.EnterRegionComplete += EnteredRegion;
            _monitorNotifier.ExitRegionComplete  += ExitedRegion;

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
コード例 #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            temp.Add("R1");
            temp.Add("R2");
            temp.Add("R3");
            temp.Add("R4");
            temp.Add("R5");
            temp.Add("R6");
            temp.Add("R7");
            temp.Add("R8");
            temp.Add("R9");
            temp.Add("R10");

            for (int k = 0; k < numberBLE; k++)
            {
                beaconActive.Add("0");
            }

            for (int k = 0; k < numberBLE; k++)
            {
                beaconTime.Add(0);
            }

            for (int k = 0; k < numberBLE; k++)
            {
                beaconDist.Add(0.0);
            }

            SetContentView(Resource.Layout.Main);

            _view = FindViewById <RelativeLayout>(Resource.Id.findTheMonkeyView);
            _text = FindViewById <TextView>(Resource.Id.monkeyStatusLabel);

            _iBeaconManager.Bind(this);

            _monitorNotifier.EnterRegionComplete += EnteredRegion;
            _monitorNotifier.ExitRegionComplete  += ExitedRegion;

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            _view = FindViewById <RelativeLayout>(Resource.Id.findTheMonkeyView);
            _text = FindViewById <TextView>(Resource.Id.monkeyStatusLabel);

            //////
            _iBeaconManager = IBeaconManager.GetInstanceForApplication(this);

            _iBeaconManager.SetForegroundScanPeriod(2000);
            _iBeaconManager.SetForegroundBetweenScanPeriod(2500);

            _rangeNotifier = new RangeNotifier();

            _rangingRegion = new Region(monkeyId, UUID, null, null);
            _iBeaconManager.Bind(this);

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #18
0
        protected override void OnCreate(Bundle bundle)
        {
            Log.Info("geodan main", "OnCreate");

            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            beaconStatusLabel      = FindViewById <TextView>(Resource.Id.beaconStatusLabel);
            beaconStatusUpdateTime = FindViewById <TextView>(Resource.Id.beaconStatusUpdateTime);
            var editTextName = FindViewById <TextView>(Resource.Id.editText1);

            var prefs1         = Application.Context.GetSharedPreferences("MyApp1", FileCreationMode.Private);
            var usernameStored = prefs1.GetString("username", null);

            if (!String.IsNullOrEmpty(usernameStored))
            {
                editTextName.Text = usernameStored;
            }

            beaconMgr.Bind(this);

            monitorNotifier.EnterRegionComplete           += EnteredRegion;
            monitorNotifier.ExitRegionComplete            += ExitedRegion;
            rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;

            var button = FindViewById <Button>(Resource.Id.button1);

            button.Click += delegate
            {
                Settings.name = editTextName.Text;
                var prefs      = Application.Context.GetSharedPreferences("MyApp1", FileCreationMode.Private);
                var prefEditor = prefs.Edit();
                prefEditor.PutString("username", Settings.name);
                prefEditor.Commit();

                editTextName.ClearFocus();
            };
        }
コード例 #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            // SetContentView(Resource.Layout.Main);

            SetContentView(Resource.Layout.layout1);
            listView = FindViewById <ListView>(Resource.Id.List); // get reference to the ListView in the layout
                                                                  // populate the listview with data

            itemsAdapter        = new MetersAdapter(this, meterList);
            listView.Adapter    = itemsAdapter;
            listView.ItemClick += OnListItemClick;  // to be defined

            _iBeaconManager.Bind(this);

            _monitorNotifier.EnterRegionComplete += EnteredRegion;
            _monitorNotifier.ExitRegionComplete  += ExitedRegion;

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
            ShowNotification();
        }
コード例 #20
0
        public BeaconLocaterAndroid()
        {
            beacons = new List<BeaconItem> ();

            //for testing
            //			beacons = new List<BeaconItem> {
            //				new BeaconItem { Name = "Android1", Minor = "1233", CurrentDistance = 0.5 },
            //				new BeaconItem { Name = "Android2", Minor = "1234", CurrentDistance = 0.2 },
            //				new BeaconItem { Name = "Android3", Minor = "1235", CurrentDistance = 12.5 },
            //			};

            context = Android.App.Application.Context;

            _iBeaconManager = IBeaconManager.GetInstanceForApplication (context);
            _monitorNotifier = new MonitorNotifier ();
            _rangeNotifier = new RangeNotifier ();

            _monitoringRegion = new Region (beaconId, uuid, null, null);
            _rangingRegion = new Region(beaconId, uuid, null, null);

            _iBeaconManager.Bind (this);

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #21
0
        public BeaconLocaterAndroid()
        {
            beacons = new List <BeaconItem> ();

            //for testing
//			beacons = new List<BeaconItem> {
//				new BeaconItem { Name = "Android1", Minor = "1233", CurrentDistance = 0.5 },
//				new BeaconItem { Name = "Android2", Minor = "1234", CurrentDistance = 0.2 },
//				new BeaconItem { Name = "Android3", Minor = "1235", CurrentDistance = 12.5 },
//			};

            context = Application.Context;

            _iBeaconManager  = IBeaconManager.GetInstanceForApplication(context);
            _monitorNotifier = new MonitorNotifier();
            _rangeNotifier   = new RangeNotifier();

            _monitoringRegion = new Region(beaconId, uuid, null, null);
            _rangingRegion    = new Region(beaconId, uuid, null, null);

            _iBeaconManager.Bind(this);

            _rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;
        }
コード例 #22
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            iBeaconManager.Bind(this);
        }
コード例 #23
0
 public void BindIBeaconManager(Activity mainActivity)
 {
     IBeaconManager = IBeaconManager.GetInstanceForApplication(mainActivity);
     IBeaconManager.Bind(mainActivity as IBeaconConsumer);
 }