List of usage examples for android.content Context bindService
public abstract boolean bindService(@RequiresPermission Intent service, @NonNull ServiceConnection conn, @BindServiceFlags int flags);
From source file:mobisocial.musubi.service.WebRenderService.java
static void bindAndSaveService(Context owner) { owner.bindService(new Intent(owner, WebRenderService.class), new WebRenderServiceConnection(), BIND_AUTO_CREATE);//from w w w . j av a 2 s. c o m }
From source file:butter.droid.base.torrent.TorrentService.java
public static void bindHere(Context context, ServiceConnection serviceConnection) { Intent torrentServiceIntent = new Intent(context, TorrentService.class); context.bindService(torrentServiceIntent, serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:eu.andlabs.studiolounge.gcp.GCPService.java
public static Lounge bind(Context ctx) { Log.d("GCP-Service", "binding GCP Service"); String name = LoginManager.getInstance(ctx).getUserId().getPlayername(); Lounge lounge = new Lounge(ctx); Intent intent = new Intent(ctx, GCPService.class); intent.putExtra("packageName", ctx.getPackageName()); intent.putExtra("messenger", lounge.mMessenger); intent.putExtra("name", name); ctx.startService(intent);/*from w w w .j a va2 s .c o m*/ ctx.bindService(intent, lounge, Context.BIND_AUTO_CREATE); return lounge; }
From source file:cn.sharesdk.analysis.EventManager.java
private static void isServiceConnect(Context context) { Ln.e("isServiceConnect ==>>", "bindService"); if (context != null) { Intent service = new Intent(context, RemoteService.class); service.setAction("cn.sharesdk.analysis.server.AIDLService"); context.startService(service);/* w ww . ja v a 2 s .c o m*/ context.bindService(service, connection, Context.BIND_AUTO_CREATE); } }
From source file:biz.wiz.android.wallet.service.BlockchainStateLoader.java
@Override protected void onStartLoading() { super.onStartLoading(); broadcastManager.registerReceiver(broadcastReceiver, new IntentFilter(BlockchainService.ACTION_BLOCKCHAIN_STATE)); final Context context = getContext(); context.bindService(new Intent(context, BlockchainServiceImpl.class), serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:com.matthewmitchell.peercoin_android_wallet.service.BlockchainStateLoader.java
@Override protected void onStartLoading() { super.onStartLoading(); broadcastManager.registerReceiver(broadcastReceiver, new IntentFilter(BlockchainService.ACTION_BLOCKCHAIN_STATE)); final Context context = getContext(); assertTrue(((WalletApplication) context.getApplicationContext()).getConfiguration() != null); context.bindService(new Intent(context, BlockchainServiceImpl.class), serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:org.strongswan.android.ui.fragment.ImcStateFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mColorIsolate = ContextCompat.getColor(getActivity(), R.color.warning_text); mColorBlock = ContextCompat.getColor(getActivity(), R.color.error_text); /* bind to the service only seems to work from the ApplicationContext */ Context context = getActivity().getApplicationContext(); context.bindService(new Intent(context, VpnStateService.class), mServiceConnection, Service.BIND_AUTO_CREATE); /* hide it initially */ getFragmentManager().beginTransaction().hide(this).commit(); }
From source file:org.strongswan.android.ui.VpnStateFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mColorStateError = ContextCompat.getColor(getActivity(), R.color.error_text); mColorStateSuccess = ContextCompat.getColor(getActivity(), R.color.success_text); /* bind to the service only seems to work from the ApplicationContext */ Context context = getActivity().getApplicationContext(); context.bindService(new Intent(context, VpnStateService.class), mServiceConnection, Service.BIND_AUTO_CREATE); mErrorConnectionID = 0;//from www . j a va2s. c o m mDismissedConnectionID = 0; if (savedInstanceState != null && savedInstanceState.containsKey(KEY_ERROR_CONNECTION_ID)) { mErrorConnectionID = (Long) savedInstanceState.getSerializable(KEY_ERROR_CONNECTION_ID); mDismissedConnectionID = (Long) savedInstanceState.getSerializable(KEY_DISMISSED_CONNECTION_ID); } }
From source file:com.agrn.senqm.network.Message.java
public void send(Context context) { if (!ConnectionManagerService.isRunning()) return;//www .jav a2 s .c om LocalServiceConnection serviceConnection = new LocalServiceConnection(context); Intent intent = new Intent(context, ConnectionManagerService.class); context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:org.strongswan.android.ui.fragment.VpnStateFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* bind to the service only seems to work from the ApplicationContext */ Context context = getActivity().getApplicationContext(); context.bindService(new Intent(context, VpnStateService.class), mServiceConnection, Service.BIND_AUTO_CREATE); mErrorConnectionID = 0;// ww w . j a va2s . c om mDismissedConnectionID = 0; if (savedInstanceState != null && savedInstanceState.containsKey(KEY_ERROR_CONNECTION_ID)) { mErrorConnectionID = (Long) savedInstanceState.getSerializable(KEY_ERROR_CONNECTION_ID); mDismissedConnectionID = (Long) savedInstanceState.getSerializable(KEY_DISMISSED_CONNECTION_ID); } }