protected override void OnHandleIntent(Android.Content.Intent intent) { GeoLocationDatabase database = new GeoLocationDatabase(); IList <IParcelable> geoLocations = ConvertToParcelableIListOf(database.getGeoLocations()); Intent broadcastIntent = new Intent(); broadcastIntent.SetAction(GeoListReceiver.PROCESS_RESPONSE); broadcastIntent.AddCategory(Intent.CategoryDefault); broadcastIntent.PutParcelableArrayListExtra("geoLocationList", geoLocations); SendBroadcast(broadcastIntent); LocalBroadcastManager.GetInstance(this).SendBroadcast(broadcastIntent); Log.Debug("IntentService", "Yes"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Xamarin.Forms.Forms.Init(this, bundle); _database = new GeoLocationDatabase(); _receiver = new GeoListReceiver(this); _recyclerView = FindViewById <RecyclerView> (Resource.Id.recycler_view); _recyclerView.AddItemDecoration(new GeoListItemDecoration(this, LinearLayoutManager.Vertical)); _layoutManager = new LinearLayoutManager(this); _recyclerView.SetLayoutManager(_layoutManager); _latitudeText = FindViewById <TextView> (Resource.Id.latitude); _longitudeText = FindViewById <TextView> (Resource.Id.longitude); StartService(new Intent(this, typeof(GeoListManager))); IntentFilter filter = new IntentFilter(GeoListReceiver.PROCESS_RESPONSE); filter.AddCategory(Intent.CategoryDefault); LocalBroadcastManager.GetInstance(this).RegisterReceiver(_receiver, filter); InitializeLocationManager(); }