public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { var prefs = Application.Context.GetSharedPreferences("settings", FileCreationMode.Private); client = AFLib.Globals.client; if (client == null) { AFLib.MojioConnectionHelper.setupMojioConnection(prefs); client = AFLib.Globals.client; } SignalRHelper.SignalRSetup(client, prefs); return(StartCommandResult.Sticky); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.mapLayout); seekBar = FindViewById <SeekBar>(Resource.Id.seekBarRadius); Button confirmRadius = FindViewById <Button> (Resource.Id.setRadius); var prefs = Application.Context.GetSharedPreferences("settings", FileCreationMode.Private); var prefEditor = prefs.Edit(); newLocation = GetCurrentLocation(); InitMapFragment(); confirmRadius.Click += delegate { prefEditor.PutString("geofencinglatitude", Convert.ToString(newLocation.Latitude)); prefEditor.PutString("geofencinglongitude", Convert.ToString(newLocation.Longitude)); prefEditor.PutInt("geofencingradius", radius); SignalRHelper.updateGeoFencing(newLocation, radius); // Radius has been set, save to user prefs and use for fenceing. Console.WriteLine("Location {0}, Radius is: {1}", newLocation, radius); }; }