コード例 #1
0
        private void Initialize()
        {
            locationUpdateReceiver = new LocationBroadcastReceiver();
            locationUpdateReceiver.locationUpdate        += onNewLocationUpdate;
            locationUpdateReceiver.SendUpdate            += onNewSentUpdate;
            locationUpdateReceiver.ConnectionStateChange += onStateChange;

            sentTimeUpdate           = new System.Timers.Timer();
            sentTimeUpdate.Interval  = 1000 * 5;
            sentTimeUpdate.Elapsed  += updateLastSent;
            sentTimeUpdate.AutoReset = true;

            lastUpdate = DateTime.MinValue;
        }
コード例 #2
0
ファイル: MainActivity.cs プロジェクト: 1stResponder/GeoTower
        /// <summary>
        /// Initializes the Broadcast receivers
        /// </summary>
        private void initReceiver()
        {
            IntentFilter fil;

            // Location Receiver
            locationReceiver = new LocationBroadcastReceiver();

            // Sensor Receiver
            sensorStateReceiver                        = new SensorStateBroadcastReceiver();
            sensorStateReceiver.SensorAdded           += SensorAdded;
            sensorStateReceiver.SensorRemoved         += SensorRemoved;
            sensorStateReceiver.SensorConnect         += SensorConnect;
            sensorStateReceiver.SensorDisconnect      += SensorDisconnect;
            sensorStateReceiver.SensorReportingPaused += SensorPause;

            RegisterReceiver();
        }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: 1stResponder/GeoTower
        /// <summary>
        /// Registers the Broadcast receivers
        /// </summary>
        private void RegisterReceiver()
        {
            IntentFilter fil;

            // Location Receiver
            locationReceiver = new LocationBroadcastReceiver();
            fil          = new IntentFilter(AppUtil.LOCATION_UPDATE_ACTION);
            fil.Priority = 98;
            Android.App.Application.Context.RegisterReceiver(locationReceiver, fil);

            fil = new IntentFilter();
            fil.AddAction(AppUtil.SENSOR_CONNECT_ACTION);
            fil.AddAction(AppUtil.SENSOR_REMOVED_ACTION);
            fil.AddAction(AppUtil.SENSOR_ADDED_ACTION);
            fil.AddAction(AppUtil.SENSOR_DISCONNECT_ACTION);
            fil.AddAction(AppUtil.SENSOR_PAUSE_ACTION);
            fil.Priority = 97;
            Android.App.Application.Context.RegisterReceiver(sensorStateReceiver, fil);
        }