78 button.setOnClickListener(new OnClickListener() { |
78 button.setOnClickListener(new OnClickListener() { |
79 |
79 |
80 @Override |
80 @Override |
81 public void onClick(View v) { |
81 public void onClick(View v) { |
82 bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); |
82 bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); |
83 Log.e("LOGIN", "bindService()"); |
|
84 } |
83 } |
85 |
84 |
86 }); |
85 }); |
87 progressDialog = new ProgressDialog(this); |
86 progressDialog = new ProgressDialog(this); |
88 } |
87 } |
89 |
88 |
90 @Override |
89 @Override |
91 protected void onDestroy() { |
90 protected void onDestroy() { |
92 super.onDestroy(); |
91 super.onDestroy(); |
93 if (mIsConnected) { |
92 if (mIsConnected) { |
94 Log.e("LOGIN", "unbindService()"); |
|
95 unbindService(mServConn); |
93 unbindService(mServConn); |
96 } |
94 } |
97 } |
95 } |
98 |
96 |
99 /** |
97 /** |
100 * {@inheritDoc} |
98 * {@inheritDoc} |
101 */ |
99 */ |
102 @Override |
100 @Override |
103 public void onStart() { |
101 public void onStart() { |
104 super.onStart(); |
102 super.onStart(); |
105 Log.e("Login", "bindService"); |
103 Log.e("LOGIN", "BINDSERVICE"); |
106 bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); |
104 bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); |
107 } |
105 } |
108 |
106 |
109 private class BeemConnectionListener extends IBeemConnectionListener.Stub { |
107 private class BeemConnectionListener extends IBeemConnectionListener.Stub { |
110 |
108 |
123 |
121 |
124 } |
122 } |
125 |
123 |
126 @Override |
124 @Override |
127 public void connectionClosed() throws RemoteException { |
125 public void connectionClosed() throws RemoteException { |
128 mIsConnected = false; |
126 /* |
129 Log.e("Login", "CONNECTIONCLOSED"); |
127 mIsConnected = false; |
130 Login.this.unbindService(mServConn); |
128 Login.this.unbindService(mServConn); |
131 Login.this.stopService(SERVICE_INTENT); |
129 Login.this.stopService(SERVICE_INTENT); |
|
130 */ |
|
131 Log.e("Login", "CONNECTIONCLOSED"); |
132 } |
132 } |
133 |
133 |
134 @Override |
134 @Override |
135 public void connectionClosedOnError() throws RemoteException { |
135 public void connectionClosedOnError() throws RemoteException { |
136 if (mIsConnected) { |
136 /* |
137 mIsConnected = false; |
137 mIsConnected = false; |
138 Login.this.unbindService(mServConn); |
138 Login.this.unbindService(mServConn); |
139 Login.this.stopService(SERVICE_INTENT); |
139 Login.this.stopService(SERVICE_INTENT); |
140 } |
140 */ |
|
141 Log.e("Login", "CONNECTIONCLOSEONERROR"); |
141 } |
142 } |
142 |
143 |
143 @Override |
144 @Override |
144 public void connectionFailed(String errorMsg) throws RemoteException { |
145 public void connectionFailed(String errorMsg) throws RemoteException { |
145 mIsConnected = false; |
146 mIsConnected = false; |
|
147 Login.this.unbindService(mServConn); |
|
148 Login.this.stopService(SERVICE_INTENT); |
146 connectionHandler.post(new ErrorRunnable(errorMsg)); |
149 connectionHandler.post(new ErrorRunnable(errorMsg)); |
147 dismissProgressDialog(); |
150 dismissProgressDialog(); |
148 showToast(errorMsg); |
151 showToast(errorMsg); |
149 } |
152 } |
150 |
153 |