예제 #1
0
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
      Intent sendIntent = new Intent();
      sendIntent.setAction(Constants.MAINACTIVITY_NLSERVICERECEIVER_ACTION);
      sendIntent.putExtra("data", notificationServiceState);
      sendBroadcast(sendIntent);
    } else {
      FLog.w(TAG, "LINKit can't get the notification message");
    }

    return START_STICKY;
  }
예제 #2
0
  private void createNewSwClient() {
    try {
      String serverIp = UserSetting.getWebSocketAddress(getApplicationContext());
      String server = "ws://" + serverIp;
      if (!serverIp.contains(":")) {
        server += ":" + Constants.WEB_SOCKET_PORT;
      }
      if (Constants.WS_NETWORK_MGR_COUCHBASE == mNetworkMgrMethod) {
        mWSManager =
            new CBRestManager /* CBLManager */(
                getBaseContext(), new URI(UserSetting.getSyncUrl()), mConnectHandler);

        FacebookChatProxyService.getInstance().setManager(mWSManager);
      } else if (Constants.WS_NETWORK_MGR_WEB_SOCKET == mNetworkMgrMethod) {
        mWSManager = new WebSocketManager(getBaseContext(), new URI(server), mConnectHandler);
        FacebookChatProxyService.getInstance().setManager(mWSManager);
      }

      FLog.i(TAG, "createNewSwClient finish, WS address: " + server);

    } catch (Exception e) {
      FLog.w(TAG, "Error on createNewSwClient");
    }
  }