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.skubit.android.example.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabs);//from w w w . j av a 2 s .c om mAdapter = new TabAdapter(getSupportFragmentManager()); bindService(new Intent("net.skubit.android.billing.IBillingService.BIND"), mServiceConn, Context.BIND_AUTO_CREATE); // tabs., skudetails and purchases // button on sku list to buy [verify if already bought], consume button // after buy // button [is billing supported] }
From source file:com.mplayer_remote.RemoteControl.java
@Override public void onStart() { super.onStart(); // Bind to ConnectAndPlayService Intent intent = new Intent(this, ConnectAndPlayService.class); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
From source file:li.barter.fragments.ChatsFragment.java
@Override public void onResume() { super.onResume(); //Bind to chat service final Intent chatServiceBindIntent = new Intent(getActivity(), ChatService.class); getActivity().bindService(chatServiceBindIntent, this, Context.BIND_AUTO_CREATE); }
From source file:com.otaupdater.SettingsActivity.java
@Override @SuppressWarnings("deprecation") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); }//from ww w .jav a 2s . co m cfg = Config.getInstance(getApplicationContext()); addPreferencesFromResource(R.xml.settings); accountPref = findPreference("account_pref"); if (cfg.isUserLoggedIn()) { accountPref.setSummary(getString(R.string.settings_account_summary_loggedin, cfg.getUsername())); } else { accountPref.setSummary(R.string.settings_account_summary); } notifPref = (CheckBoxPreference) findPreference("notif_pref"); notifPref.setChecked(cfg.getShowNotif()); wifidlPref = (CheckBoxPreference) findPreference("wifidl_pref"); wifidlPref.setChecked(cfg.getWifiOnlyDl()); autodlPref = (CheckBoxPreference) findPreference("autodl_pref"); autodlPref.setChecked(cfg.getAutoDlState()); prokeyPref = findPreference("prokey_pref"); if (cfg.hasProKey()) { prokeyPref.setTitle(R.string.settings_prokey_title_pro); } updateProKeySummary(); resetWarnPref = findPreference("resetwarn_pref"); donatePref = findPreference("donate_pref"); bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), serviceConn, Context.BIND_AUTO_CREATE); if (EXTRA_SHOW_GET_PROKEY_DLG.equals(getIntent().getAction())) { showGetProKeyDialog(); } if (EXTRA_SHOW_ACCOUNT_DLG.equals(getIntent().getAction())) { showAccountDialog(); } }
From source file:com.sonetel.ui.calllog.CallLogListFragment.java
@Override public void onResume() { super.onResume(); if (pDialog != null) pDialog.dismiss();//from ww w .j a va 2 s . c o m fetchCalls(); getActivity().bindService(new Intent(SipManager.INTENT_SIP_SERVICE), connection, Context.BIND_AUTO_CREATE); }
From source file:com.molidt.easyandroid.bluetooth.BluetoothFragmentV4.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!isInit) { initPlugin(_activity);//from w w w. j av a2s. c o m } _Handler = new Handler(); //if UUID is null,using the package name to setting the default UUID if (BLUETOOTH_UUID == null) { BLUETOOTH_UUID = UUID.fromString(_activity.getPackageName()); } IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); filter.addAction(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED); _activity.registerReceiver(mFoundReceiver, filter); if (isSupportBLE) { Intent gattServiceIntent = new Intent(_activity, BluetoothLeService.class); _activity.bindService(gattServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE); } }
From source file:de.appplant.cordova.plugin.background.BackgroundMode.java
/** * Bind the activity to a background service and put them into foreground * state.//from w w w . jav a 2s.com */ private void startService() { Activity context = cordova.getActivity(); Intent intent = new Intent(context, ForegroundService.class); if (isDisabled || isBind) return; try { context.bindService(intent, connection, Context.BIND_AUTO_CREATE); fireEvent(Event.ACTIVATE, null); context.startService(intent); } catch (Exception e) { fireEvent(Event.FAILURE, e.getMessage()); } isBind = true; }
From source file:uk.co.senab.photoview.sample.ViewPagerActivity.java
@SuppressLint("NewApi") @Override//from w w w.j a va2 s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setWindowFeatures(); setContentView(R.layout.activity_view_pager); makeActionBarTransparent(); connection = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { mservice = null; } @Override public void onServiceConnected(ComponentName name, IBinder service) { mservice = IInAppBillingService.Stub.asInterface(service); } }; bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), connection, Context.BIND_AUTO_CREATE); File n = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/.13linequran/13 line quran/881.jpg"); File file = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/13linequran.zip"); if (file.exists() && n.exists()) file.delete(); if (!n.exists()) { Intent intent = new Intent(ViewPagerActivity.this, DownloadActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } sharedPref = this.getPreferences(Context.MODE_PRIVATE); editor = sharedPref.edit(); /*subscribed=sharedPref.getBoolean("subscribed", false); if(!subscribed) { subscribed=getIntent().getBooleanExtra("validated", false); if(subscribed==true) { editor.putBoolean("subscribed", true); editor.commit(); getIntent().removeExtra("validated"); getIntent().addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); } } if(!subscribed){ Intent suscribe= new Intent(ViewPagerActivity.this,SubscriptionActivity.class); suscribe.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(suscribe); finish(); } */ //if(getIntent().getBooleanExtra("validated", true)==false){ if (getIntent().hasExtra("code") && sharedPref.getBoolean("done", false) == false || sharedPref.contains("code") && sharedPref.getBoolean("done", false) == false) { Log.e("place", "0"); if (getIntent().hasExtra("code")) { code = getIntent().getIntExtra("code", 0); email = getIntent().getStringExtra("email"); editor.putString("email", email); editor.putInt("code", code); editor.commit(); Log.e("place", sharedPref.getInt("code", 0) + ""); } if (!internetIsConnected(ViewPagerActivity.this)) { Log.e("place", "1"); } else if (internetIsConnected(ViewPagerActivity.this)) { Log.e("place", "2"); new SendTask().execute(); } } //} int index = 881; String page = ""; getOverflowMenu(); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getOrient = getWindowManager().getDefaultDisplay(); mViewPager = (HackyViewPager) findViewById(R.id.view_pager); rated = false; rated = sharedPref.getBoolean("rated", false); mViewPager.setActionBar(getActionBar()); mViewPager.setAdapter(new SamplePagerAdapter()); mViewPager.setCurrentItem(index); if (sharedPref.getInt("continuePage", -1) != -1) { index = (sharedPref.getInt("continuePage", -1)); } try { Intent intent = getIntent(); page = intent.getStringExtra("PAGE"); index = Integer.parseInt(page); Log.e("Page", page); } catch (NullPointerException d) { Log.e("Page", "none1"); } catch (RuntimeException e) { Log.e("Page", "none" + e); } mViewPager.setCurrentItem(index); mDbHelper = new NotesDbAdapter(this); mDbHelper.open(); }
From source file:de.j4velin.wifiAutoOff.Locations.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); Database db = Database.getInstance(this); locations = db.getLocations();//w w w . ja v a 2 s .c o m db.close(); setContentView(R.layout.locations); findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (PREMIUM_ENABLED || locations.size() < 1) { startActivityForResult(new Intent(Locations.this, Map.class), REQUEST_LOCATION); } else { AlertDialog.Builder builder = new AlertDialog.Builder(Locations.this); builder.setMessage(R.string.buy_pro); builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { try { Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), "de.j4velin.wifiautomatic.billing.pro", "inapp", getPackageName()); if (buyIntentBundle.getInt("RESPONSE_CODE") == 0) { PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT"); startIntentSenderForResult(pendingIntent.getIntentSender(), REQUEST_BUY, null, 0, 0, 0); } } catch (Exception e) { if (BuildConfig.DEBUG) Logger.log(e); Toast.makeText(Locations.this, e.getClass().getName() + ": " + e.getMessage(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } } }); mRecyclerView = (RecyclerView) findViewById(R.id.locations); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); mAdapter = new LocationsAdapter(); mRecyclerView.setAdapter(mAdapter); PREMIUM_ENABLED |= getSharedPreferences("settings", Context.MODE_PRIVATE).getBoolean("pro", false); if (!PREMIUM_ENABLED) { bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND") .setPackage("com.android.vending"), mServiceConn, Context.BIND_AUTO_CREATE); } findViewById(R.id.timeoutwarning).setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { getSharedPreferences(getPackageName() + "_preferences", Context.MODE_MULTI_PROCESS).edit() .putInt("no_network_timeout", 5).commit(); v.setVisibility(View.GONE); } }); }
From source file:com.secupwn.aimsicd.ui.activities.MapViewerOsmDroid.java
@Override public void onResume() { super.onResume(); setUpMapIfNeeded();/*from w ww. j a v 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(this, AimsicdService.class); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); } loadPreferences(); loadEntries(); if (mCompassOverlay != null) { mCompassOverlay.enableCompass(); } if (mMyLocationOverlay != null) { mMyLocationOverlay.enableMyLocation(); } }