List of usage examples for android.content Context BIND_AUTO_CREATE
int BIND_AUTO_CREATE
To view the source code for android.content Context BIND_AUTO_CREATE.
Click Source Link
From source file:au.com.dektech.dektalk.MainActivity.java
@Override protected void onStart() { super.onStart(); // The activity is about to become visible. Log.i(TAG, "%% onStart"); bindService(new Intent(this, RCDevice.class), this, Context.BIND_AUTO_CREATE); }
From source file:com.stephenmcgruer.simpleupnp.fragments.ServerBrowserFragment.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO(smcgruer): Handle failure gracefully. Log.d(TAG, "onCreate: binding service"); if (!getActivity().getApplicationContext().bindService( new Intent(getActivity(), AndroidUpnpServiceImpl.class), mServiceConnection, Context.BIND_AUTO_CREATE)) { throw new IllegalStateException("Unable to bind AndroidUpnpServiceImpl"); }/* w w w .j a v a2 s . c om*/ }
From source file:com.SecUpwN.AIMSICD.activities.MapViewer.java
/** * Called when the activity is first created. *///from w w w.ja va 2 s . c o m @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "Starting MapViewer"); super.onCreate(savedInstanceState); if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) != ConnectionResult.SUCCESS) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.error_google_play_services_message) .setTitle(R.string.error_google_play_services_title); builder.create().show(); finish(); } setContentView(R.layout.map); setUpMapIfNeeded(); mContext = this; mDbHelper = new AIMSICDDbAdapter(mContext); // Bind to LocalService Intent intent = new Intent(mContext, AimsicdService.class); mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
From source file:com.parrot.cyclops.CameraView.java
public void start(boolean isClosingNeeded) { logdebug("start"); mIsClosingNeeded = isClosingNeeded;/*from www . ja va2 s . c o m*/ // Bind to CyclopsService Intent intent = new Intent(mContext, CyclopsService.class); mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
From source file:me.henrytao.smoothappbarlayoutdemo.activity.BaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); serviceIntent.setPackage("com.android.vending"); bindService(serviceIntent, mServiceConnection, Context.BIND_AUTO_CREATE); }
From source file:ack.me.truconnectandroiddemo.MainActivity.java
@Override protected void onStart() { super.onStart(); mDeviceList.clear();// w ww .j a v a2 s . c om mConnected = false; mConnecting = false; Intent intent = new Intent(this, TruconnectService.class); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); mLocalBroadcastManager.registerReceiver(mBroadcastReceiver, mReceiverIntentFilter); }
From source file:com.mbientlab.metawear.app.ModuleActivity.java
@SuppressWarnings("unchecked") @Override/*from w w w . j av a 2 s . c o m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); if (!bluetoothManager.getAdapter().isEnabled()) { final Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableIntent, REQUEST_ENABLE_BT); } getApplicationContext().bindService(new Intent(this, MetaWearBleService.class), this, Context.BIND_AUTO_CREATE); if (savedInstanceState != null) { device = (BluetoothDevice) savedInstanceState.getParcelable(EXTRA_BLE_DEVICE); moduleFragment = (ModuleFragment) getSupportFragmentManager().getFragment(savedInstanceState, "mContent"); tapType = savedInstanceState.getInt(Extra.TAP_TYPE); tapAxis = savedInstanceState.getInt(Extra.TAP_AXIS); shakeAxis = savedInstanceState.getInt(Extra.SHAKE_AXIS); dataRange = savedInstanceState.getInt(Extra.DATA_RANGE); samplingRate = savedInstanceState.getInt(Extra.SAMPLING_RATE); ffMovement = savedInstanceState.getBoolean(Extra.FF_MOVEMENT); newFirmware = savedInstanceState.getBoolean(Extra.NEW_FIRMWARE); samplingConfigBytes = savedInstanceState.getByteArray(Extra.SAMPLING_CONFIG_BYTES); polledData = (ArrayList<byte[]>) savedInstanceState.getSerializable(Extra.POLLED_DATA); } }
From source file:com.example.run_tracker.MainActivity.java
protected void onResume() { super.onResume(); // bind (and start the service) Intent intent = new Intent(this, TrackingService.class); bindService(intent, myConnection, Context.BIND_AUTO_CREATE); }
From source file:com.nokia.example.pepperfarm.iap.Payment.java
/** * Binds to Nokia in-app payment service. * * @param ctx/*from w w w.ja va2 s .c o m*/ * @throws GeneralSecurityException If Nokia In-App payment enabler fingerprint is not valid */ public void connectToService(Context ctx) throws GeneralSecurityException { activity = (Activity) ctx; //Verifies enabler fingerprint if (!verifyFingreprint()) { npayAvailable = false; errorAlert("Nokia In-App Payment Enabler is not available."); throw new GeneralSecurityException("Enabler fingerprint incorrect. Billing unavailable"); } else { //Enabler fingerprint OK. Continue with binding. Intent paymentEnabler = new Intent("com.nokia.payment.iapenabler.InAppBillingService.BIND"); paymentEnabler.setPackage(ENABLER_PACKAGENAME); activity.bindService(paymentEnabler, this, Context.BIND_AUTO_CREATE); } }
From source file:edu.nd.darts.cimon.CimonListView.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cimonlist);/*from w ww . j ava 2s. c om*/ category = getIntent().getExtras().getInt("key"); list = this.getExpandableListView(); list.setGroupIndicator(null); handler = new Handler(); switch (category) { case Metrics.TYPE_SYSTEM: adminObserver = SystemObserver.getInstance(); break; case Metrics.TYPE_SENSOR: adminObserver = SensorObserver.getInstance(); break; case Metrics.TYPE_USER: adminObserver = UserObserver.getInstance(); break; default: if (DebugLog.ERROR) Log.e(TAG, "CimonListView.onCreate - unknown category:" + category); } // this.setListAdapter(new SystemAdapter(this, ActiveMonitor.getInstance().getSystems())); getSupportLoaderManager().initLoader(0, null, this); adapter = new CimonListAdapter(this, adminObserver); this.setListAdapter(adapter); backgroundThread.start(); if (getApplicationContext().bindService(new Intent(NDroidService.class.getName()), mConnection, Context.BIND_AUTO_CREATE)) { if (DebugLog.DEBUG) Log.d(TAG, "CimonListView.onCreate - bind service. category:" + category); } else { if (DebugLog.DEBUG) Log.d(TAG, "CimonListView.onCreate - bind service failed. category:" + category); } monitorReports = new SparseArray<MonitorReport>(); /* backgroundHandler = new Handler(backgroundThread.getLooper()); backgroundHandler.post(new Runnable() { public void run() { serviceList = MetricService.getServices(category); } });*/ }