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.piusvelte.mosaic.android.MosaicMap.java
@Override public void onResume() { super.onResume(); if (map == null) map = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map)) .getMap();/*from w ww . j a v a 2s . c o m*/ map.setMyLocationEnabled(true); map.setOnMapLongClickListener(this); UiSettings uiSettings = map.getUiSettings(); uiSettings.setMyLocationButtonEnabled(false); uiSettings.setScrollGesturesEnabled(false); uiSettings.setZoomControlsEnabled(false); uiSettings.setZoomGesturesEnabled(false); map.setOnMarkerClickListener(this); getActivity(); getActivity().bindService(new Intent(getActivity(), MosaicService.class), this, Context.BIND_AUTO_CREATE); }
From source file:gov.nasa.arc.geocam.geocam.CameraPreviewActivity.java
@Override public void onResume() { super.onResume(); mServiceBound = bindService(new Intent(this, GeoCamService.class), mServiceConn, Context.BIND_AUTO_CREATE); mForeground.foreground();//from w ww.j a v a2s .com }
From source file:com.google.android.DemoKit.DemoKitActivity.java
@Override protected void onStart() { super.onStart(); Intent nocServiceIntent = new Intent(this, NocAccessService.class); bindService(nocServiceIntent, mNocConnection, Context.BIND_AUTO_CREATE); /* Intent btServiceIntent = new Intent(this, BluetoothService.class); bindService(btServiceIntent, mBTConnection, Context.BIND_AUTO_CREATE); *///from w ww . j ava2 s. c o m Intent accessoryIntent = new Intent(this, MegaADKController.class); bindService(accessoryIntent, mAccessoryConnection, Context.BIND_AUTO_CREATE); }
From source file:cx.ring.client.HomeActivity.java
@Override public void onCreate(Bundle savedInstanceState) { setDefaultUncaughtExceptionHandler(); mToolbarSize = getResources().getDimension(R.dimen.abc_action_bar_default_height_material); super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); toolbar = (Toolbar) findViewById(R.id.main_toolbar); setSupportActionBar(toolbar);/*from w w w . ja v a2s . c o m*/ actionButton = (FloatingActionButton) findViewById(R.id.action_button); fMenu = (NavigationView) findViewById(R.id.left_drawer); fMenu.setNavigationItemSelectedListener(this); mNavigationDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mNavigationDrawer, /* DrawerLayout object */ // R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { @Override public void onDrawerClosed(View view) { invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { invalidateOptionsMenu(); } }; mNavigationDrawer.setDrawerListener(mDrawerToggle); // Bind to LocalService String[] toRequest = LocalService.checkRequiredPermissions(this); if (toRequest.length > 0) { ActivityCompat.requestPermissions(this, toRequest, LocalService.PERMISSIONS_REQUEST); } else if (!mBound) { Log.i(TAG, "onCreate: Binding service..."); Intent intent = new Intent(this, LocalService.class); startService(intent); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); } }
From source file:com.quadmeup.smartporttelemetrer.activity.RawDataActivity.java
@Override protected void onStart() { super.onStart(); // Bind to LocalService Intent intent = new Intent(this, DataService.class); bindService(intent, dataServiceConnection, Context.BIND_AUTO_CREATE); }
From source file:com.saulcintero.moveon.MainHolder.java
private void bindService() { if (!isBound) { isBound = bindService(new Intent(this, MoveOnService.class), this, Context.BIND_AUTO_CREATE); }//from w w w . j a va 2 s . c o m }
From source file:com.mobileobservinglog.support.billing.DonationBillingHandler.java
public void startSetup(final OnSetupFinishedListener listener) { // If already set up, can't do it again. if (setupDone) { Log.d("InAppPurchase", "Setup was already done -- handler"); return;/*w w w. ja v a 2s . c om*/ } serviceConn = new ServiceConnection() { public void onServiceDisconnected(ComponentName name) { service = null; } public void onServiceConnected(ComponentName name, IBinder bindService) { service = IInAppBillingService.Stub.asInterface(bindService); String packageName = context.getPackageName(); try { //Checking for in-app billing 3 support. int response = service.isBillingSupported(3, packageName, ITEM_TYPE_INAPP); if (response != BILLING_RESPONSE_RESULT_OK) { if (listener != null) listener.onSetupFinished( new BillingHandlerResult(response, "Error checking for billing v3 support.")); return; } setupDone = true; } catch (RemoteException e) { if (listener != null) { listener.onSetupFinished(new BillingHandlerResult(BILLINGHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing.")); } e.printStackTrace(); } if (listener != null) { listener.onSetupFinished( new BillingHandlerResult(BILLING_RESPONSE_RESULT_OK, "Setup successful.")); } } }; context.bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), serviceConn, Context.BIND_AUTO_CREATE); }
From source file:com.digitalarx.android.ui.activity.FileActivity.java
/** * Loads the ownCloud {@link Account} and main {@link OCFile} to be handled by the instance of * the {@link FileActivity}.//from w ww.j a v a 2 s .c o m * * Grants that a valid ownCloud {@link Account} is associated to the instance, or that the user * is requested to create a new one. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); mFileOperationsHelper = new FileOperationsHelper(this); Account account; if (savedInstanceState != null) { account = savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT); mFile = savedInstanceState.getParcelable(FileActivity.EXTRA_FILE); mFromNotification = savedInstanceState.getBoolean(FileActivity.EXTRA_FROM_NOTIFICATION); mFileOperationsHelper .setOpIdWaitingFor(savedInstanceState.getLong(KEY_WAITING_FOR_OP_ID, Long.MAX_VALUE)); } else { account = getIntent().getParcelableExtra(FileActivity.EXTRA_ACCOUNT); mFile = getIntent().getParcelableExtra(FileActivity.EXTRA_FILE); mFromNotification = getIntent().getBooleanExtra(FileActivity.EXTRA_FROM_NOTIFICATION, false); } setAccount(account, savedInstanceState != null); mOperationsServiceConnection = new OperationsServiceConnection(); bindService(new Intent(this, OperationsService.class), mOperationsServiceConnection, Context.BIND_AUTO_CREATE); mDownloadServiceConnection = newTransferenceServiceConnection(); if (mDownloadServiceConnection != null) { bindService(new Intent(this, FileDownloader.class), mDownloadServiceConnection, Context.BIND_AUTO_CREATE); } mUploadServiceConnection = newTransferenceServiceConnection(); if (mUploadServiceConnection != null) { bindService(new Intent(this, FileUploader.class), mUploadServiceConnection, Context.BIND_AUTO_CREATE); } }
From source file:com.kentli.cycletrack.RecordingActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recording);//w w w. ja va 2 s . c o m initWidget(); if (rService == null) rService = new Intent(RecordingActivity.this, RecordingService.class); startService(rService); ServiceConnection sc = new ServiceConnection() { public void onServiceDisconnected(ComponentName name) { } public void onServiceConnected(ComponentName name, IBinder service) { IRecordService rs = (IRecordService) service; recordService = rs; int state = rs.getState(); updateUIAccordingToState(rs.getState()); if (state > RecordingService.STATE_IDLE) { if (state == RecordingService.STATE_FULL) { startActivity(new Intent(RecordingActivity.this, SaveTrip.class)); } else { if (state == RecordingService.STATE_RECORDING) { isRecording = true; initTrip(); } //PAUSE or RECORDING... recordService.setListener(RecordingActivity.this); } } else { // First run? Switch to user prefs screen if there are no prefs stored yet SharedPreferences settings = getSharedPreferences("PREFS", 0); if (settings.getAll().isEmpty()) { showWelcomeDialog(); } } RecordingActivity.this.unbindService(this); // race? this says we no longer care // Before we go to record, check GPS status final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { buildAlertMessageNoGps(); } } }; // This needs to block until the onServiceConnected (above) completes. // Thus, we can check the recording status before continuing on. bindService(rService, sc, Context.BIND_AUTO_CREATE); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); //Google Map MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); setButtonOnClickListeners(); }