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.nuvolect.securesuite.main.ContactListActivity.java
/** * Starts the communications framework.//from w ww. j a v a 2 s. co m */ void doBindService() { // Establish a connection with the service. We use an explicit // class name because there is no reason to be able to let other // applications replace our component. bindService(new Intent(this, WorkerService.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true; }
From source file:com.binomed.showtime.android.screen.results.CineShowTimeResultsFragment.java
private void bindService() { interaction.getMainContext().bindService( new Intent(interaction.getMainContext(), CineShowTimeResultsService.class), mConnection, Context.BIND_AUTO_CREATE); }
From source file:com.intuit.qboecoui.email.SalesFormEmail.java
private void preview(Uri pdfUri) { CustomLog.logDebug(TAG, "QBOViewTransactionFragment : preview() started"); final Intent intent = new Intent(this, PreviewService.class); intent.setData(pdfUri);/*w w w . j a v a 2s . c om*/ this.bindService(intent, mPreviewServiceConnection, Context.BIND_AUTO_CREATE); this.startService(intent); // TODO P1 : Check if we need to show progress "mProgress" bar here to indicate rendering in pdf viewer. }
From source file:com.nbplus.iotlib.IoTInterface.java
/** * Method used for binding with the service */// w w w . ja v a2s . com private boolean bindService() { /* * Note that this is an implicit Intent that must be defined in the * Android Manifest. */ Intent i = null; if (IoTConstants.USE_ANOTHER_APP) { i = new Intent(); i.setClassName(REMOTE_IOT_SERVICE_PACKAGE, REMOTE_IOT_SERVICE_CLASS); i.setAction(REMOTE_IOT_SERVICE_ACTION); } else { i = new Intent(mCtx, IoTService.class); i.setAction(REMOTE_IOT_SERVICE_ACTION); } try { if (mCtx.getApplicationContext().bindService(i, mConnection, Context.BIND_AUTO_CREATE)) { return true; } } catch (SecurityException e) { e.printStackTrace(); Log.e(TAG, "Not allowed to bind to service Intent"); } mServiceStatus = IoTServiceStatus.NONE; return false; }
From source file:net.czlee.debatekeeper.DebatingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_debate); mLeftControlButton = (Button) findViewById(R.id.mainScreen_leftControlButton); mLeftCentreControlButton = (Button) findViewById(R.id.mainScreen_leftCentreControlButton); mCentreControlButton = (Button) findViewById(R.id.mainScreen_centreControlButton); mRightControlButton = (Button) findViewById(R.id.mainScreen_rightControlButton); mPlayBellButton = (Button) findViewById(R.id.mainScreen_playBellButton); ////from w w w . j a v a 2s .com // ViewPager mViewPager = (EnableableViewPager) findViewById(R.id.mainScreen_debateTimerViewPager); mViewPager.setAdapter(new DebateTimerDisplayPagerAdapter()); mViewPager.addOnPageChangeListener(new DebateTimerDisplayOnPageChangeListener()); mViewPager.setPageMargin(1); mViewPager.setPageMarginDrawable(R.drawable.divider); // // OnClickListeners mPlayBellButton.setOnClickListener(new PlayBellButtonOnClickListener()); mLastStateBundle = savedInstanceState; // This could be null // // Find the style file name String filename = loadXmlFileName(); // If there doesn't appear to be an existing style selected, then start // the Activity to select the style immediately, and don't bother with the // rest. if (filename == null) { Intent getStyleIntent = new Intent(DebatingActivity.this, FormatChooserActivity.class); startActivityForResult(getStyleIntent, CHOOSE_STYLE_REQUEST); } // // Start the timer service Intent intent = new Intent(this, DebatingTimerService.class); startService(intent); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); // // If there's been an update, show the changelog. SharedPreferences prefs = getPreferences(MODE_PRIVATE); Resources res = getResources(); int thisChangelogVersion = res.getInteger(R.integer.changelogDialog_versionCode); int lastChangelogVersionShown = prefs.getInt(LAST_CHANGELOG_VERSION_SHOWN, 0); if (lastChangelogVersionShown < thisChangelogVersion) { if (isFirstInstall()) { // Don't show on the dialog on first install, but take note of the version. Editor editor = prefs.edit(); editor.putInt(LAST_CHANGELOG_VERSION_SHOWN, thisChangelogVersion); editor.apply(); } else { // The dialog will update the preference to the new version code. showDialog(new DialogChangelogFragment(), DIALOG_TAG_CHANGELOG); } } }
From source file:com.crearo.gpslogger.GpsMainActivity.java
/** * Starts the service and binds the activity to it. *//* w w w . j a va2s. co m*/ private void startAndBindService() { serviceIntent = new Intent(this, GpsLoggingService.class); // Start the service in case it isn't already running startService(serviceIntent); // Now bind to service bindService(serviceIntent, gpsServiceConnection, Context.BIND_AUTO_CREATE); Session.setBoundToService(true); }
From source file:com.klinker.android.launcher.launcher3.Launcher.java
@Override protected void onStart() { super.onStart(); FirstFrameAnimatorHelper.setIsVisible(true); if (mLauncherCallbacks != null) { mLauncherCallbacks.onStart();/*from ww w . j av a2 s . co m*/ } if (AppSettings.getInstance(this).shouldPersist) { Intent persister = new Intent(getApplicationContext(), PersisterService.class); bindService(persister, new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { Log.v("blur_persister", "connection to persistent service established"); } @Override public void onServiceDisconnected(ComponentName name) { Log.v("blur_persister", "connection to persistent service destroyed"); } }, Context.BIND_AUTO_CREATE); } }
From source file:com.amaze.filemanager.activities.MainActivity.java
public void bindDrive() { Intent i = new Intent(); i.setClassName("com.amaze.filemanager.driveplugin", "com.amaze.filemanager.driveplugin.MainService"); try {//from ww w. j av a 2 s .c o m bindService((i), mConnection, Context.BIND_AUTO_CREATE); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.google.android.apps.santatracker.launch.StartupActivity.java
private void registerWithService() { bindService(new Intent(this, SantaService.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true;/*from w w w . j ava2 s . co m*/ }
From source file:net.networksaremadeofstring.rhybudd.RhybuddHome.java
void doBindService() { bindService(new Intent(this, ZenossPoller.class), mConnection, Context.BIND_AUTO_CREATE); mBound = true; }