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.android.terminal.TerminalActivity.java
@Override protected void onStart() { super.onStart(); bindService(new Intent(this, TerminalService.class), mServiceConn, Context.BIND_AUTO_CREATE); }
From source file:com.zentri.otademo.ConnectActivity.java
@Override protected void onStart() { super.onStart(); mDeviceList.clear();/* w w w . ja v a2 s .co m*/ //connect to service if (mLocalBroadcastManager != null) { Intent intent = new Intent(this, ZentriOSBLEService.class); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); startTimeout(mServiceConnectionTimeoutTask, TIMEOUT_SERVICE_CON); mLocalBroadcastManager.registerReceiver(mBroadcastReceiver, mReceiverIntentFilter); } }
From source file:com.github.jvanhie.discogsscrobbler.NowPlayingFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (mDiscogs == null) mDiscogs = Discogs.getInstance(getActivity()); if (mImageLoader == null) { //create universal image loader mImageLoader = ImageLoader.getInstance(); DisplayImageOptions options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.default_release).cacheInMemory() .displayer(new FadeInBitmapDisplayer(500)).build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity()).enableLogging() .defaultDisplayImageOptions(options).build(); mImageLoader.init(config);//ww w . jav a 2s .com } /*bind to the now playing service*/ Intent intent = new Intent(getActivity(), NowPlayingService.class); getActivity().bindService(intent, mConnection, Context.BIND_AUTO_CREATE); setHasOptionsMenu(true); }
From source file:com.onesignal.TrackGooglePurchase.java
void trackIAP() { if (mServiceConn == null) { mServiceConn = new ServiceConnection() { @Override//from w w w . jav a 2 s .co m public void onServiceDisconnected(ComponentName name) { iapEnabled = -99; mIInAppBillingService = null; } @Override public void onServiceConnected(ComponentName name, IBinder service) { try { Class<?> stubClass = Class.forName("com.android.vending.billing.IInAppBillingService$Stub"); Method asInterfaceMethod = getAsInterfaceMethod(stubClass); asInterfaceMethod.setAccessible(true); mIInAppBillingService = asInterfaceMethod.invoke(null, service); QueryBoughtItems(); } catch (Throwable t) { t.printStackTrace(); } } }; Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); serviceIntent.setPackage("com.android.vending"); appContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); } else if (mIInAppBillingService != null) QueryBoughtItems(); }
From source file:com.abcvoipsip.ui.messages.MessageFragment.java
@Override public void onAttach(SupportActivity activity) { super.onAttach(activity); getActivity().bindService(new Intent(getActivity(), SipService.class), connection, Context.BIND_AUTO_CREATE); }
From source file:com.nus.cs4222.isbtracker.MainActivity.java
@Override public void onStart() { super.onStart(); mConnection = new ServiceConnection() { @Override// w w w. ja va 2 s . co m public void onServiceConnected(ComponentName name, IBinder service) { ScannerService.ScannerBinder binder = (ScannerService.ScannerBinder) service; mService = binder.getService(); // Set state machine listener (before binding to service) mService.setStateMachineListener(mStateMachineListener); mIsBound = true; Log.d(LOGTAG, "Service connected"); } @Override public void onServiceDisconnected(ComponentName name) { mService = null; mIsBound = false; Log.d(LOGTAG, "Service disconnected"); } }; // Start and bind to service Intent intent = new Intent(this, ScannerService.class); startService(intent); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
From source file:com.bangz.shotrecorder.RecordActivity.java
private void doBindService() { bindService(new Intent(RecordActivity.this, RecordService.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true;//from w ww . j a va2 s. com }
From source file:com.achep.acdisplay.services.media.MediaController2KitKat.java
/** * {@inheritDoc}//from w w w . ja v a 2 s .com */ @Override public void onStart(Object... objects) { super.onStart(); Intent intent = new Intent(App.ACTION_BIND_MEDIA_CONTROL_SERVICE); mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
From source file:net.named_data.nfd.MainFragment.java
/** * Method that binds the current activity to the NfdService. *//* ww w. j a va2 s.c o m*/ private void bindNfdService() { if (!m_isNfdServiceConnected) { // Bind to Service getActivity().bindService(new Intent(getActivity(), NfdService.class), m_ServiceConnection, Context.BIND_AUTO_CREATE); G.Log("MainFragment::bindNfdService()"); } }
From source file:com.ubimobitech.spotifystreamer.PlaybackFragment.java
/** * Dispatch onStart() to all fragments. Ensure any created loaders are * now started.// w w w.j a va2s . com */ @Override public void onStart() { super.onStart(); Intent intent = new Intent(getActivity(), MusicService.class); getActivity().startService(intent); getActivity().bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }