Example usage for android.content Context BIND_AUTO_CREATE

List of usage examples for android.content Context BIND_AUTO_CREATE

Introduction

In this page you can find the example usage for android.content Context BIND_AUTO_CREATE.

Prototype

int BIND_AUTO_CREATE

To view the source code for android.content Context BIND_AUTO_CREATE.

Click Source Link

Document

Flag for #bindService : automatically create the service as long as the binding exists.

Usage

From source file:devza.app.android.droidnetkey.FirewallAction.java

public FirewallAction(Context context, boolean status, boolean refresh) {
    this.context = context;
    this.fwstatus = status;
    this.refresh = refresh;

    client = new StbFwHttpsClient(this.context);

    HttpParams params = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(params, TIMEOUT);
    HttpConnectionParams.setSoTimeout(params, TIMEOUT);

    client.setParams(params);//from ww w .j av  a  2s  .c  om

    if (!refresh)
        this.context.bindService(new Intent(this.context, ConnectionService.class), mConnection,
                Context.BIND_AUTO_CREATE);
}

From source file:com.example.weatherforecast.WeatherForecastActivity.java

@Override
protected void onResume() {
    super.onResume();

    Cursor c = weatherForecastDatabase.getForecast(database, 0);
    adapter.changeCursor(c);/* w  w w  . java  2  s. co m*/

    EventBus.getDefault().register(this);

    Intent intent = new Intent(this, WeatherForecastService.class);
    intent.putExtra(WeatherForecastService.BUNDLE_KEY_FORECAST_URL, forecastUrl);
    bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
}

From source file:com.kentdisplays.synccardboarddemo.FileDownloadService.java

private void bindToFtpService() {
    Intent ftpServiceIntent = new Intent(this, SyncFtpService.class);
    bindService(ftpServiceIntent, mFtpConnection, Context.BIND_AUTO_CREATE);
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.MyHealthHubGlassMainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (D)//from  ww w  . j ava  2 s.  c  o m
        Log.d(TAG, "onCreate");
    setContentView(R.layout.glass_sensor_type_config);

    pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

    // StartProducer message handler
    mMessageHandlerIntent = new Intent(this, MessageHandler.class);
    startService(mMessageHandlerIntent);

    // StartProducer sensor modules
    mSensorModuleManagerIntent = new Intent(getApplicationContext(), SensorModuleManager.class);
    getApplicationContext().bindService(mSensorModuleManagerIntent, mSensorModuleManagerConnection,
            Context.BIND_AUTO_CREATE);
    startService(mSensorModuleManagerIntent);

    viewHolder = new ViewHolder();
    viewHolder.tv_typePulse = (TextView) findViewById(R.id.sensor_name);
    viewHolder.tv_typePulse.setText(getResources().getString(R.string.pulse));

    viewHolder.tv_PulseSensorAdd = (TextView) findViewById(R.id.device_add);

    viewHolder.pulseCheckBox = (CheckBox) findViewById(R.id.enablePulse);
    viewHolder.autoConnectCheckBox = (CheckBox) findViewById(R.id.autoEnable);

    viewHolder.tv_typeAcc = (TextView) findViewById(R.id.acc_sensor_name);
    viewHolder.tv_AccSensorAdd = (TextView) findViewById(R.id.acc_device_add);
    viewHolder.accCheckBox = (CheckBox) findViewById(R.id.enableAcc);

}

From source file:com.inovex.zabbixmobile.activities.GraphFullscreenActivity.java

/**
 * Binds the Zabbix service.//  w  w  w  . j av a2  s  .c  om
 */
protected void bindService() {
    Intent intent = new Intent(this, ZabbixDataService.class);
    getApplicationContext().bindService(intent, this, Context.BIND_AUTO_CREATE);
}

From source file:org.jboss.aerogear.android.authorization.oauth2.OAuth2AuthzModule.java

@Override
public void requestAccess(final Activity activity, final Callback<String> callback) {

    final String state = UUID.randomUUID().toString();

    final OAuth2AuthzService.AGAuthzServiceConnection connection = new OAuth2AuthzService.AGAuthzServiceConnection() {

        @Override/*from w  w  w. jav a 2s . c om*/
        public void onServiceConnected(ComponentName className, IBinder iBinder) {
            super.onServiceConnected(className, iBinder);
            doRequestAccess(state, activity, callback, this);
        }

    };

    activity.bindService(new Intent(activity.getApplicationContext(), OAuth2AuthzService.class), connection,
            Context.BIND_AUTO_CREATE);

}

From source file:com.mbientlab.metawear.app.ModuleFragmentBase.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (!(activity instanceof FragmentBus)) {
        throw new ClassCastException(String.format(Locale.US, "%s %s", activity.toString(),
                activity.getString(R.string.error_fragment_bus)));
    }/*from   w  w  w  .jav a  2 s .  c o  m*/

    fragBus = (FragmentBus) activity;
    activity.getApplicationContext().bindService(new Intent(activity, MetaWearBleService.class), this,
            Context.BIND_AUTO_CREATE);
}

From source file:com.coinblesk.client.ui.authview.AuthenticationDialog.java

@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);

    Intent walletServiceIntent = new Intent(getContext(), WalletService.class);
    getActivity().bindService(walletServiceIntent, serviceConnection, Context.BIND_AUTO_CREATE);

    setCancelable(false);// w w  w  .jav a2 s . c o  m
}

From source file:com.lambdasoup.quickfit.ui.BaseActivity.java

@Override
protected void onStart() {
    super.onStart();
    bindService(new Intent(this, FitApiFailureResolutionService.class),
            fitApiFailureResolutionServiceConnection, Context.BIND_AUTO_CREATE);
}

From source file:devicroft.burnboy.Activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d(LOG_TAG, "onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    initialiseAd();//from  w w w. jav  a 2  s  . co  m
    setupFAB();

    IntentFilter filter = new IntentFilter("devicroft.BurnBoy.CANCEL_NOTIFY");
    this.registerReceiver(new NotificationCancelReceiver(), filter);
    if (getIntent().getAction() == Intent.ACTION_DELETE) {
        Intent intent = new Intent();
        intent.setAction("devicroft.BurnBoy.CANCEL_NOTIFY");
        intent.putExtra("id", NotificationCancelReceiver.NOTIFICATION_ID);
        sendBroadcast(intent);
    }

    ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (LogService.getName().equals(service.service.getClassName())) {
            Log.d(LOG_TAG, " REBIND on SERVICE");
            Toast.makeText(this, "Still logging movement", Toast.LENGTH_SHORT);
            this.bindService(new Intent(this, LogService.class), serviceConnection, Context.BIND_AUTO_CREATE);
        }
    }

    TextView distance = (TextView) findViewById(R.id.distanceFocus);
}