android.support.v4.app.FragmentActivity.bindService()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中android.support.v4.app.FragmentActivity.bindService()方法的一些代码示例,展示了FragmentActivity.bindService()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentActivity.bindService()方法的具体详情如下:
包路径:android.support.v4.app.FragmentActivity
类名称:FragmentActivity
方法名:bindService

FragmentActivity.bindService介绍

暂无

代码示例

代码示例来源:origin: ManbangGroup/Phantom

@Override
public boolean bindService(Intent service, ServiceConnection conn, int flags) {
  return super.bindService(setPluginServiceFlag(service), conn, flags);
}

代码示例来源:origin: vitas/beaconloc

@Override
public boolean bindService(Intent intent, ServiceConnection serviceConnection, int i) {
  Log.d(Constants.TAG, "scan fragment bound to beacon service");
  return getActivity().bindService(intent, serviceConnection, i);
}

代码示例来源:origin: cookpad/issue-reporter-android

protected boolean bindService(Intent service, ServiceConnection conn, int flags) {
  return getActivity().bindService(service, conn, flags);
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox

/**
 * Method called when user selected a device on the scanner dialog after the service has been started.
 * Here we may bind this fragment to it.
 */
public void onServiceStarted() {
  // The service has been started, bind to it
  final Intent service = new Intent(getActivity(), UARTService.class);
  requireActivity().bindService(service, mServiceConnection, 0);
}

代码示例来源:origin: azhon/SmackChat

/**
 * 绑定服务
 */
private void bind() {
  //开启服务获得与服务器的连接
  Intent intent = new Intent(getActivity(), ConnectionService.class);
  getActivity().bindService(intent, connection, BIND_AUTO_CREATE);
}

代码示例来源:origin: azhon/SmackChat

private void bind() {
  //开启服务获得与服务器的连接
  Intent intent = new Intent(getActivity(), ConnectionService.class);
  getActivity().bindService(intent, connection, BIND_AUTO_CREATE);
}

代码示例来源:origin: fccaikai/AppUpdate

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  mTvTitle = (TextView) view.findViewById(R.id.title);
  mBtnCancel = (Button) view.findViewById(R.id.btnCancel);
  mBtnCancel.setOnClickListener(this);
  mBtnBackground = (Button) view.findViewById(R.id.btnBackground);
  mBtnBackground.setOnClickListener(this);
  mProgressBar = (ProgressBar) view.findViewById(R.id.progressBar);
  mProgressBar.setMax(100);
  Intent intent = new Intent(getActivity(), DownLoadService.class);
  getActivity().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
  if (mMustUpdate) {
    view.findViewById(R.id.downLayout).setVisibility(View.GONE);
  }
  if (!mIsShowBackgroundDownload) {
    mBtnBackground.setVisibility(View.GONE);
  }
}

代码示例来源:origin: openxc/openxc-android

@Override
public void onResume() {
  super.onResume();
  if (getActivity() != null) {
    getActivity().bindService(
        new Intent(getActivity(), VehicleManager.class),
        mConnection, Context.BIND_AUTO_CREATE);
  }
}

代码示例来源:origin: openxc/openxc-android

@Override
public void onResume() {
  super.onResume();
  if (getActivity() != null) {
    getActivity().bindService(
        new Intent(getActivity(), VehicleManager.class),
        mConnection, Context.BIND_AUTO_CREATE);
  }
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox

@Override
public void onStart() {
  super.onStart();
  /*
   * If the service has not been started before the following lines will not start it. However, if it's running, the Activity will be bound to it
   * and notified via mServiceConnection.
   */
  final Intent service = new Intent(getActivity(), UARTService.class);
  requireActivity().bindService(service, mServiceConnection, 0); // we pass 0 as a flag so the service will not be created if not exists
}

代码示例来源:origin: openxc/openxc-android

@Override
public void onResume() {
  super.onResume();
  getActivity().bindService(
      new Intent(getActivity(), VehicleManager.class),
      mConnection, Context.BIND_AUTO_CREATE);
}

代码示例来源:origin: openxc/openxc-android

@Override
public void onResume() {
  super.onResume();
  getActivity().bindService(
      new Intent(getActivity(), VehicleManager.class),
      mConnection, Context.BIND_AUTO_CREATE);
}

代码示例来源:origin: Ashish-Bansal/OneTapVideoDownload

@Override
public void onResume() {
  super.onResume();
  if (mBounded == null || !mBounded) {
    getActivity().startService(DownloadManager.getActionStartService());
    Intent mIntent = new Intent(getActivity(), DownloadManager.class);
    getActivity().bindService(mIntent, mConnection, Context.BIND_ABOVE_CLIENT);
  }
}

代码示例来源:origin: AnandChowdhary/saga-android

@Override
public void onStart() {
  super.onStart();
  if (playIntent == null) {
    playIntent = new Intent(getActivity(), MusicService.class);
    getActivity().bindService(playIntent, musicConnection, Context.BIND_AUTO_CREATE);
    getActivity().startService(playIntent);
  }
}

代码示例来源:origin: TeamWalrus/Walrus

@Override
public void onResume() {
  super.onResume();
  getActivity().bindService(new Intent(getActivity(), BulkReadCardsService.class),
      bulkReadCardsServiceConnection, 0);
  LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(
      getActivity());
  localBroadcastManager.registerReceiver(
      bulkReadCardDataSinkUpdateBroadcastReceiver,
      new IntentFilter(BulkReadCardDataSink.ACTION_UPDATE));
  localBroadcastManager.registerReceiver(
      bulkReadCardsServiceUpdateNotificationHandler,
      new IntentFilter(BulkReadCardsService.ACTION_UPDATE));
}

代码示例来源:origin: blurpy/kouchat-android

@Override
public void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  serviceConnection = createServiceConnection();
  final Intent chatServiceIntent = createChatServiceIntent();
  getActivity().bindService(chatServiceIntent, serviceConnection, Context.BIND_NOT_FOREGROUND);
}

代码示例来源:origin: openxc/openxc-android

@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
  super.setUserVisibleHint(isVisibleToUser);
  if (isVisibleToUser) {
    getActivity().bindService(
        new Intent(getActivity(), VehicleManager.class),
        mConnection, Context.BIND_AUTO_CREATE);
  } else {
    if(mVehicleManager != null) {
      Log.i(TAG, "Unbinding from vehicle service");
      mVehicleManager.removeListener(CanMessage.class, mListener);
      getActivity().unbindService(mConnection);
      mVehicleManager = null;
    }
  }
}

代码示例来源:origin: openxc/openxc-android

@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
  super.setUserVisibleHint(isVisibleToUser);
  if(getActivity() == null) {
    return;
  }
  if (isVisibleToUser) {
    getActivity().bindService(
        new Intent(getActivity(), VehicleManager.class),
        mConnection, Context.BIND_AUTO_CREATE);
  } else {
    if(mVehicleManager != null) {
      Log.i(TAG, "Unbinding from vehicle service");
      mVehicleManager.removeListener(SimpleVehicleMessage.class, mListener);
      mVehicleManager.removeListener(EventedSimpleVehicleMessage.class, mListener);
      getActivity().unbindService(mConnection);
      mVehicleManager = null;
    }
  }
}

代码示例来源:origin: pocmo/Yaaic

intent.setAction(IRCService.ACTION_FOREGROUND);
getActivity().startService(intent);
getActivity().bindService(intent, this, 0);

代码示例来源:origin: HelloChenJinJun/TestChat

intent.setClass(getContext(), GroupMessageService.class);
    getActivity().bindService(intent, connection, Service.BIND_AUTO_CREATE);
} else {
    LogUtil.e("已经绑定了");

相关文章

微信公众号

最新文章

更多

FragmentActivity类方法