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.owncloud.android.MainApp.java
@SuppressFBWarnings("ST") public void onCreate() { super.onCreate(); JobManager.create(this).addJobCreator(new NCJobCreator()); MainApp.mContext = getApplicationContext(); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); MainApp.storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH, Environment.getExternalStorageDirectory().getAbsolutePath()); boolean isSamlAuth = AUTH_ON.equals(getString(R.string.auth_method_saml_web_sso)); OwnCloudClientManagerFactory.setUserAgent(getUserAgent()); if (isSamlAuth) { OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT); } else {//from w w w. j ava 2s .co m OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT); } // initialise thumbnails cache on background thread new ThumbnailsCacheManager.InitDiskCacheTask().execute(); if (BuildConfig.DEBUG) { String dataFolder = getDataFolder(); // Set folder for store logs Log_OC.setLogDataFolder(dataFolder); Log_OC.startLogging(MainApp.storagePath); Log_OC.d("Debug", "start logging"); } cleanOldEntries(); updateAutoUploadEntries(); Log_OC.d("SyncedFolderObserverService", "Start service SyncedFolderObserverService"); Intent i = new Intent(this, SyncedFolderObserverService.class); startService(i); bindService(i, syncedFolderObserverServiceConnection, Context.BIND_AUTO_CREATE); // register global protection with pass code registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() { @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { Log_OC.d(activity.getClass().getSimpleName(), "onCreate(Bundle) starting"); WhatsNewActivity.runIfNeeded(activity); PassCodeManager.getPassCodeManager().onActivityCreated(activity); } @Override public void onActivityStarted(Activity activity) { Log_OC.d(activity.getClass().getSimpleName(), "onStart() starting"); PassCodeManager.getPassCodeManager().onActivityStarted(activity); } @Override public void onActivityResumed(Activity activity) { Log_OC.d(activity.getClass().getSimpleName(), "onResume() starting"); } @Override public void onActivityPaused(Activity activity) { Log_OC.d(activity.getClass().getSimpleName(), "onPause() ending"); } @Override public void onActivityStopped(Activity activity) { Log_OC.d(activity.getClass().getSimpleName(), "onStop() ending"); PassCodeManager.getPassCodeManager().onActivityStopped(activity); } @Override public void onActivitySaveInstanceState(Activity activity, Bundle outState) { Log_OC.d(activity.getClass().getSimpleName(), "onSaveInstanceState(Bundle) starting"); } @Override public void onActivityDestroyed(Activity activity) { Log_OC.d(activity.getClass().getSimpleName(), "onDestroy() ending"); } }); }
From source file:ir.aarani.bazaar.billing.BillingProcessor.java
private void bindPlayServices() { try {//from w w w. j a va 2s .c om Intent iapIntent = new Intent("ir.cafebazaar.pardakht.InAppBillingService.BIND"); iapIntent.setPackage("com.farsitel.bazaar"); getContext().bindService(iapIntent, serviceConnection, Context.BIND_AUTO_CREATE); } catch (Exception e) { Log.e(LOG_TAG, "error in bindPlayServices", e); } }
From source file:com.mbientlab.metawear.starter.DeviceSetupActivityFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Activity owner = getActivity();//w ww. ja va2s. co m if (!(owner instanceof FragmentSettings)) { throw new ClassCastException("Owning activity must implement the FragmentSettings interface"); } settings = (FragmentSettings) owner; owner.getApplicationContext().bindService(new Intent(owner, MetaWearBleService.class), this, Context.BIND_AUTO_CREATE); }
From source file:com.android.car.trust.CarEnrolmentActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.car_client); mOutputText = (TextView) findViewById(R.id.textfield); final Intent intent = new Intent(this, CarEnrolmentService.class); mPrefs = PreferenceManager.getDefaultSharedPreferences(this /* context */); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_TOKEN_STATUS_RESULT); filter.addAction(ACTION_ADD_TOKEN_RESULT); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this /* context */); mLocalBroadcastManager.registerReceiver(mReceiver, filter); mStartButton = (Button) findViewById(R.id.start_button); mStartButton.setOnClickListener(new View.OnClickListener() { @Override//from w ww . ja v a 2s. c o m public void onClick(View v) { // binding the service will start it if not started. bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE); } }); Button revokeButton = (Button) findViewById(R.id.revoke_trust_button); revokeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(CarBleTrustAgent.ACTION_REVOKE_TRUST); intent.setPackage(getPackageName()); sendBroadcast(intent); } }); }
From source file:com.pandoroid.PandoroidStationSelect.java
void doBindService() { // Establish a connection with the service. We use an explicit // class name because we want a specific service implementation that // we know will be running in our own process (and thus won't be // supporting component replacement by other applications). bindService(new Intent(this, PandoraRadioService.class), m_connection, Context.BIND_AUTO_CREATE); }
From source file:com.jogden.spunkycharts.MainApplication.java
public static void connectToDataService() { thisApp.bindService(new Intent(thisApp, DataContentService.class), ourDataServiceConnection = new ServiceConnection() { public void onServiceConnected(ComponentName name, IBinder binder) { ourDataService = ((DataContentService.OurBinder) binder).getService(); DataContentService.connect(); }//from w w w .j a va2s.c o m public void onServiceDisconnected(ComponentName name) { ourDataService = null; } }, Context.BIND_AUTO_CREATE); thisApp.startService(new Intent(thisApp, DataContentService.class)); }
From source file:com.SecUpwN.AIMSICD.activities.MapViewer.java
@Override public void onResume() { super.onResume(); setUpMapIfNeeded();//from w ww . j av a 2 s . c o m prefs = this.getSharedPreferences(AimsicdService.SHARED_PREFERENCES_BASENAME, 0); prefs.registerOnSharedPreferenceChangeListener(this); LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(updateOpenCellIDMarkers)); if (!mBound) { // Bind to LocalService Intent intent = new Intent(mContext, AimsicdService.class); mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); } loadPreferences(); loadEntries(); }
From source file:com.owncloud.android.ui.activity.FileDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mFile = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_FILE); mAccount = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_ACCOUNT); mStorageManager = new FileDataStorageManager(mAccount, getContentResolver()); // check if configuration changed to large-land ; for a tablet being changed from portrait to landscape when in FileDetailActivity Configuration conf = getResources().getConfiguration(); mConfigurationChangedToLandscape = (conf.orientation == Configuration.ORIENTATION_LANDSCAPE && (conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE); if (!mConfigurationChangedToLandscape) { setContentView(R.layout.file_activity_details); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); if (savedInstanceState == null) { mWaitingToPreview = false;//w ww . ja va 2 s . c o m createChildFragment(); } else { mWaitingToPreview = savedInstanceState.getBoolean(KEY_WAITING_TO_PREVIEW); } mDownloadConnection = new DetailsServiceConnection(); bindService(new Intent(this, FileDownloader.class), mDownloadConnection, Context.BIND_AUTO_CREATE); mUploadConnection = new DetailsServiceConnection(); bindService(new Intent(this, FileUploader.class), mUploadConnection, Context.BIND_AUTO_CREATE); } else { backToDisplayActivity(false); // the 'back' won't be effective until this.onStart() and this.onResume() are completed; } }
From source file:com.turbulenz.turbulenz.googlepayment.java
public googlepayment(Activity activity, int purchaseRequestCode) { mActivity = activity;/* w w w.j a v a 2 s .c o m*/ mPurchaseRequestCode = purchaseRequestCode; // Just listens for connection / disconnection mServiceConnection = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { _log("service disconnected :("); mService = null; mReady = false; reportReady(false); } @Override public void onServiceConnected(ComponentName name, IBinder service) { _log("service connected :)"); mService = IInAppBillingService.Stub.asInterface(service); String packageName = mActivity.getPackageName(); _log("checking for billing.3 in " + packageName + "..."); try { int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP); if (BILLING_RESPONSE_RESULT_OK == response) { mReady = true; } else { _log("billing v3 not supported for this package"); } } catch (RemoteException e) { _error("remoteexception:"); e.printStackTrace(); } reportReady(mReady); } }; _log("binding service ..."); boolean bound = activity.bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), mServiceConnection, Context.BIND_AUTO_CREATE); _log("back from bindService: bound: " + Boolean.toString(bound)); }
From source file:org.teleal.cling.android.browser.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // identity = // getIntent().getExtras().getString(ContentActivity.DEVICE_UUID); deviceListAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1); listview = getListView();/* w ww .j av a2s .c o m*/ switchToDeviceList(); getApplicationContext().bindService(new Intent(this, BrowserUpnpService.class), serviceConnection, Context.BIND_AUTO_CREATE); }