Beispiel #1
0
 /** Method to send message to web socket server */
 private boolean sendMessageToServer(String message) {
   if (client != null && client.isConnected()) {
     Log.d(TAG + ":sendMessageToServer", "client connected");
     client.send(message);
     return true;
   } else {
     startWebSocketClient();
     return false;
   }
 }
Beispiel #2
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   stopLocationUpdates();
   if (mLocalBroadcastManager != null) {
     mLocalBroadcastManager.unregisterReceiver(mBroadcastReceiver);
   }
   if (client != null & client.isConnected()) {
     client.disconnect();
     clientListener = null;
     client = null;
   }
 }