예제 #1
0
        public void StartRagingBeacons()
        {
            MvxTrace.TaggedTrace(TAG, "StartRagingBeacons");

            if (_rangeNotifier != null)
            {
                return;
            }

            BEACONS_REGION_HEADER = $"beacons_{Context.PackageName}";

            _beaconManager = BeaconManager.GetInstanceForApplication(this);

            _regionBootstrap = new RegionBootstrap(this, new AltBeaconOrg.BoundBeacon.Region(BEACONS_REGION_HEADER, null, null, null));
            _powerSaver      = new BackgroundPowerSaver(this);

            RegisterActivityLifecycleCallbacks(this);

            _rangeNotifier = new RangeNotifier();

            //iBeacon
            _beaconManager.BeaconParsers.Add(new BeaconParser().SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

            //Estimote
            _beaconManager.BeaconParsers.Add(new BeaconParser().SetBeaconLayout(BeaconParser.EddystoneUidLayout));
            _beaconManager.BeaconParsers.Add(new BeaconParser().SetBeaconLayout(BeaconParser.EddystoneTlmLayout));

            _beaconManager.BeaconParsers.Add(new BeaconParser().SetBeaconLayout(BeaconParser.EddystoneUrlLayout));

            _beaconManager.Bind(this);
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            backgroundPowerSaver = new BackgroundPowerSaver(this);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
예제 #3
0
        /// <summary>
        /// Initializes some classes and plugins on creation.
        /// </summary>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource    = Resource.Layout.Tabbar;
            ToolbarResource      = Resource.Layout.Toolbar;
            backgroundPowerSaver = new BackgroundPowerSaver(this);
            ZXing.Net.Mobile.Forms.Android.Platform.Init();
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new HealthcareApp.App());
        }
        public override void OnCreate()
        {
            base.OnCreate();

            var beaconManager = BeaconManager.GetInstanceForApplication(this);

            // By default the AndroidBeaconLibrary will only find AltBeacons.  If you wish to make it
            // find a different type of beacon, you must specify the byte layout for that beacon's
            // advertisement with a line like below.  The example shows how to find a beacon with the
            // same byte layout as AltBeacon but with a beaconTypeCode of 0xaabb.  To find the proper
            // layout expression for other beacon types, do a web search for "setBeaconLayout"
            // including the quotes.
            //
            //beaconManager.getBeaconParsers().clear();
            //beaconManager.getBeaconParsers().add(new BeaconParser().
            //        setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
            //
            // Estimote
            // iBeacons
            //beaconManager.getBeaconParsers().add(new BeaconParser().
            //	      setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));

            var altBeaconParser = new BeaconParser();

            altBeaconParser.SetBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
            beaconManager.BeaconParsers.Add(altBeaconParser);

            var iBeaconParser = new BeaconParser();

            iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
            beaconManager.BeaconParsers.Add(iBeaconParser);

            Debug.WriteLine("setting up background monitoring for beacons and power saving", TAG);

            // wake up the app when a beacon is seen
            var region = new Region("backgroundRegion", null, null, null);

            regionBootstrap = new RegionBootstrap(this, region);

            // simply constructing this class and holding a reference to it in your custom Application
            // class will automatically cause the BeaconLibrary to save battery whenever the application
            // is not visible.  This reduces bluetooth power usage by about 60%
            backgroundPowerSaver = new BackgroundPowerSaver(this);

            // If you wish to test beacon detection in the Android Emulator, you can use code like this:
            //BeaconManager.BeaconSimulator = new TimedBeaconSimulator();
            //if (BeaconManager.BeaconSimulator is TimedBeaconSimulator simulator) {
            //	//simulator.CreateTimedSimulatedBeacons();
            //	simulator.CreateBasicSimulatedBeacons();
            //}
        }
        /// <summary>
        /// 生成時の処理
        /// </summary>
        public override void OnCreate()
        {
            base.OnCreate();

            //通知チャンネル登録
            NotificationUtil.Instance.CreateNotificationChannel((NotificationManager)GetSystemService(NotificationService), this);

            //Firebase初期化
            FirebaseApp.InitializeApp(this);
            var db = FirebaseDatabase.Instance;

            FirebaseDatabase.Instance.SetPersistenceEnabled(true); //オフライン機能の有効化

            InitBeaconManager();
            InitBeaconRegion();
            _backgroundPowerSaver = new BackgroundPowerSaver(this);
        }
		public override void OnCreate()
		{
			base.OnCreate();

			_beaconManager = BeaconManager.GetInstanceForApplication(this);

			var iBeaconParser = new BeaconParser();
			//	Estimote > 2013
			iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
			_beaconManager.BeaconParsers.Add(iBeaconParser);

			Log.Debug(TAG, "setting up background monitoring for beacons and power saving");
			// wake up the app when a beacon is seen
			_backgroundRegion = new Region("backgroundRegion", null, null, null);
			regionBootstrap = new RegionBootstrap(this, _backgroundRegion);

			// simply constructing this class and holding a reference to it in your custom Application
			// class will automatically cause the BeaconLibrary to save battery whenever the application
			// is not visible.  This reduces bluetooth power usage by about 60%
			backgroundPowerSaver = new BackgroundPowerSaver(this);
		}
        public override void OnCreate()
        {
            base.OnCreate();

            _beaconManager = BeaconManager.GetInstanceForApplication(this);

            var iBeaconParser = new BeaconParser();

            //	Estimote > 2013
            iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
            _beaconManager.BeaconParsers.Add(iBeaconParser);

            Log.Debug(TAG, "setting up background monitoring for beacons and power saving");
            // wake up the app when a beacon is seen
            _backgroundRegion = new Region("backgroundRegion", null, null, null);
            regionBootstrap   = new RegionBootstrap(this, _backgroundRegion);

            // simply constructing this class and holding a reference to it in your custom Application
            // class will automatically cause the BeaconLibrary to save battery whenever the application
            // is not visible.  This reduces bluetooth power usage by about 60%
            backgroundPowerSaver = new BackgroundPowerSaver(this);
        }
예제 #8
0
        //async Task StartNearbyDiscovery()
        //{
        //    if (CrossConnectivity.Current.ConnectionTypes.Contains(Plugin.Connectivity.Abstractions.ConnectionType.WiFi))
        //    {
        //        var status = await NearbyClass.Connections.StartDiscovery(mGoogleApiClient, serviceId, TIMEOUT_DISCOVER, new MyConnectionsEndpointDiscoveryListener(this));

        //        if (status.IsSuccess)
        //        {
        //            //DebugLog("startDiscovery:onResult: SUCCESS");

        //            //UpdateViewVisibility(NearbyConnectionState.Discovering);
        //        }
        //        else
        //        {
        //            //DebugLog("startDiscovery:onResult: FAILURE");

        //            int statusCode = status.StatusCode;
        //            if (statusCode == ConnectionsStatusCodes.StatusAlreadyDiscovering)
        //            {
        //                //DebugLog("STATUS_ALREADY_DISCOVERING");
        //            }
        //            else
        //            {
        //                //UpdateViewVisibility(NearbyConnectionState.Ready);
        //            }
        //        }
        //    }
        //}

        public bool StartScanningBle()
        {
            NearbyShoots = new HashSet <Shoot>();
            _shortcodes  = new HashSet <string>();

            if (!VerifyBluetooth())
            {
                return(false);
            }

            _beaconManager = BeaconManager.GetInstanceForApplication(ApplicationContext);

            ////  Estimote > 2013
            _beaconManager.BeaconParsers.Add(new BeaconParser().SetBeaconLayout(BeaconParser.EddystoneUrlLayout));

            _beaconManager.Bind(this);
            _beaconManager.SetRangeNotifier(this);

            backgroundPowerSaver = new BackgroundPowerSaver(ApplicationContext);

            return(true);
        }
		public override void OnCreate()
		{
			base.OnCreate();
			backgroundPowerSaver = new BackgroundPowerSaver(this);
		}
예제 #10
0
 public override void OnCreate()
 {
     base.OnCreate();
     backgroundPowerSaver = new BackgroundPowerSaver(this);
 }