protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.AcShoppingLists); var startServiceIntent = new Intent(ShAppContext, typeof(SyncService)); con = new SyncCom(this); ApplicationContext.BindService(startServiceIntent, con, Bind.AutoCreate); llShoppingLst = FindViewById <LinearLayout>(Resource.Id.listShopping); btnCreateList = FindViewById <Button>(Resource.Id.btnCreateList); btnCreateList.Click += AddNewList; LoadLists(); GenerateUILists(); IntentFilter filter = new IntentFilter(Intent.ActionSend); MessageReciever receiver = new MessageReciever(this); LocalBroadcastManager.GetInstance(this).RegisterReceiver(receiver, filter); PrepareDB(); }//OnCreate
private void InitService() { _serviceConnection = new AdditionServiceConnection(this); var additionServiceIntent = new Intent("com.xamarin.additionservice"); _serviceConnection = new AdditionServiceConnection(this); ApplicationContext.BindService(additionServiceIntent, _serviceConnection, Bind.AutoCreate); Log.Debug(Tag, "Service initialized"); }
protected override void OnStart() { base.OnStart(); var demoServiceIntent = new Intent("com.xamarin.DemoService"); demoServiceConnection = new DemoServiceConnection(this); ApplicationContext.BindService(demoServiceIntent, demoServiceConnection, Bind.AutoCreate); }
protected override void OnResume() { serviceConnection = new TunnelServiceConnection(OnBoundToTunnelService, OnUnBoundToTunnelService); ApplicationContext.BindService(new Intent(this, typeof(TunnelService)), serviceConnection, Bind.AutoCreate); Console.WriteLine("On Resume"); logView.SetText(savedText, TextView.BufferType.Editable); scrollView.ScrollTo(0, logView.Height); scrollView.FullScroll(FocusSearchDirection.Down); SetupBluetooth(); base.OnResume(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); serviceConnection = new TunnelServiceConnection( delegate(TunnelService.TunnelBinder binder){ //On connect tunnel = binder.Tunnel; OnBoundToTunnelService(tunnel); //isBound = true; }, delegate(TunnelService.TunnelBinder binder){ //On disconnect //isBound = false; } ); ApplicationContext.BindService(new Intent(this, typeof(TunnelService)), serviceConnection, Bind.AutoCreate); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.MyButton); button.Click += button_Click; this.ApplicationContext.StartService(new Intent(this, typeof(ComputeFunction.ComputeService))); Intent serviceIntent = new Intent(this, typeof(ComputeFunction.ComputeService)); IServiceConnection conn = new ComputeFunction.ServiceConnection(this); ApplicationContext.BindService(serviceIntent, conn, Bind.AutoCreate); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ApplicationContext.BindService(new Intent(this, typeof(SinchService)), this, Bind.AutoCreate); }