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:com.inovex.zabbixmobile.activities.BaseActivity.java
/** * Binds the Zabbix service./*from w w w .j a va 2 s. c om*/ */ protected void bindService() { Intent intent = new Intent(this, ZabbixDataService.class); boolean useMockData = getIntent().getBooleanExtra(ZabbixDataService.EXTRA_IS_TESTING, false); intent.putExtra(ZabbixDataService.EXTRA_IS_TESTING, useMockData); getApplicationContext().bindService(intent, this, Context.BIND_AUTO_CREATE); }
From source file:com.sonetel.ui.dialpad.DialerFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); getActivity().bindService(new Intent(SipManager.INTENT_SIP_SERVICE), connection, Context.BIND_AUTO_CREATE); // timings.addSplit("Bind asked for two"); if (prefsWrapper == null) { prefsWrapper = new PreferencesWrapper(getActivity()); }/*from w ww . j av a 2 s . co m*/ if (dialFeedback == null) { dialFeedback = new DialingFeedback(getActivity(), false); } dialFeedback.resume(); }
From source file:com.yschi.castscreen.MainActivity.java
private void startService() { if (mResultCode != 0 && mResultData != null && mReceiverIp != null) { Intent intent = new Intent(this, CastService.class); intent.putExtra(Common.EXTRA_RESULT_CODE, mResultCode); intent.putExtra(Common.EXTRA_RESULT_DATA, mResultData); intent.putExtra(Common.EXTRA_RECEIVER_IP, mReceiverIp); intent.putExtra(Common.EXTRA_VIDEO_FORMAT, mSelectedFormat); intent.putExtra(Common.EXTRA_SCREEN_WIDTH, mSelectedWidth); intent.putExtra(Common.EXTRA_SCREEN_HEIGHT, mSelectedHeight); intent.putExtra(Common.EXTRA_SCREEN_DPI, mSelectedDpi); intent.putExtra(Common.EXTRA_VIDEO_BITRATE, mSelectedBitrate); Log.d(TAG, "===== start service ====="); startService(intent);/*www. ja v a 2 s. c om*/ bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE); } else { Intent intent = new Intent(this, CastService.class); startService(intent); bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE); } }
From source file:com.nordicsemi.nrfUARTv2.MainActivity.java
private void service_init() { Intent bindIntent = new Intent(this, UartService.class); bindService(bindIntent, mServiceConnection, Context.BIND_AUTO_CREATE); LocalBroadcastManager.getInstance(this).registerReceiver(UARTStatusChangeReceiver, makeGattUpdateIntentFilter()); }
From source file:com.beestar.ble.ble.ui.BleScanActivity.java
/** * ?//from w ww . ja v a2 s . c o m */ private void doBindService() { Intent serviceIntent = new Intent(this, BleService.class); bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:edu.umich.flowfence.service.Sandbox.java
private void bind() { onBeforeConnect.fire(this, null); int flags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT | Context.BIND_DEBUG_UNBIND; if (localLOGD) { Log.d(TAG, "binding: " + this); }/*from ww w. ja v a 2 s . c o m*/ String[] packages = new String[s_mKnownPackages.size()]; packages = s_mKnownPackages.toArray(packages); Intent bindIntent = new Intent().setComponent(mComponent).putExtras(s_mExtrasBundle) .putExtra(SandboxService.EXTRA_KNOWN_PACKAGES, packages) .putExtra(SandboxService.EXTRA_SANDBOX_ID, mID); if (!mApplication.bindService(bindIntent, mConnection, flags)) { Log.e(TAG, "Couldn't bind to sandbox " + mID); } }
From source file:com.github.chenxiaolong.dualbootpatcher.patcher.PatchFileFragment.java
/** * {@inheritDoc}/*from ww w. j av a 2 s .c o m*/ */ @Override public void onStart() { super.onStart(); // Bind to our service. We start the service so it doesn't get killed when all the clients // unbind from the service. The service will automatically stop once all clients have // unbinded and all tasks have completed. Intent intent = new Intent(getActivity(), PatcherService.class); getActivity().bindService(intent, this, Context.BIND_AUTO_CREATE); getActivity().startService(intent); }
From source file:com.secupwn.aimsicd.ui.activities.MainActivity.java
private void startService() { // don't start service if disclaimer is not accepted if (!prefs.getBoolean(mDisclaimerAccepted, false)) { return;/*from ww w . j a va 2 s. c o m*/ } if (!mBound) { // Bind to LocalService Intent intent = new Intent(MainActivity.this, AimsicdService.class); //Start Service before binding to keep it resident when activity is destroyed startService(intent); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); openFragment(deviceFragment); } }
From source file:com.yourkey.billing.util.InAppBilling.java
public boolean startServiceConnection(String itemType, String itemSku, boolean consumeActivity) { // already active if (active)//from w ww .j a v a2s .c om return (false); // set active active = true; // save item type inapp or Subs this.itemType = itemType; // save requested item SKU this.itemSku = itemSku; // buy or consume the item this.consumeActivity = consumeActivity; // create bind service intent object Intent serviceIntent = new Intent(BIND_SERVICE_INTENT); serviceIntent.setPackage(SERVICE_INTENT_PACKAGE); // make sure there is at least one service matching the intent if (applicationContext.getPackageManager().resolveService(serviceIntent, 0) == null) { // no service available to handle that Intent // call purchase listener with error message active = false; inAppBillingListener.inAppBillingFailure(errorMessage(PLAY_STORE_UNAVAILABLE)); return (true); } // define connect and disconnect methods to handle call back from InAppBillingService serviceConnection = new ServiceConnection() { // service was disconnected call back @Override public void onServiceDisconnected(ComponentName name) { // reset serviceConnection to make sure that dispose method will not un-bind the service serviceConnection = null; active = false; // report service is disconnected to listener inAppBillingListener.inAppBillingFailure(errorMessage(PLAY_STORE_SERVICE_DISCONNECTED)); return; } // service was connected call back @Override public void onServiceConnected(ComponentName name, IBinder service) { // process service connected serviceConnected(service); return; } }; try { // bind the service to our context and // pass the service connection object defining the connect and disconnect call back methods if (!applicationContext.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE)) { // reset serviceConnection to make sure that dispose method will not un-bind the service serviceConnection = null; active = false; inAppBillingListener.inAppBillingFailure(errorMessage(PLAY_STORE_UNAVAILABLE)); return (true); } } // binding to in app billing service failed catch (Exception e) { // reset serviceConnection to make sure that dispose method will not un-bind the service serviceConnection = null; active = false; inAppBillingListener.inAppBillingFailure(exceptionMessage(PLAY_STORE_UNAVAILABLE, e)); return (true); } // exit while waiting for service connection return (true); }
From source file:com.android.strictmodetest.StrictModeActivity.java
@Override public void onResume() { super.onResume(); bindService(new Intent(this, LocalService.class), mLocalServiceConn, Context.BIND_AUTO_CREATE); bindService(new Intent(this, RemoteService.class), mRemoteServiceConn, Context.BIND_AUTO_CREATE); }