Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Intent intent = new Intent(SplashActivity.this, TCPConnectionService.class);
- startForegroundService(intent);
- } else {
- Intent intent = new Intent(SplashActivity.this, TCPConnectionService.class);
- startService(intent);
- }
- private ServiceConnection mConnection = new ServiceConnection() {
- //EDITED PART
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mBoundService = ((TCPConnectionService.LocalBinder) service).getService();
- mIsBound = true;
- Log.e("SERVICE CONNECTED>>>>", "yes");
- }
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mBoundService = null;
- }
- };
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_settings);
- Log.e("SERVICE CONNECTED 222>>", "yes");
- doBindService();
- sendAuthenticate();
- }
- private void doBindService() {
- getApplicationContext().bindService(new Intent(getApplicationContext(), TCPConnectionService.class), mConnection, Context.BIND_AUTO_CREATE);
- if (mBoundService != null) {
- mBoundService.IsBoundable();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement