KiteConenct.generateSession(requestToken, apiSecret) need requestToken as parameter. Below comment says /* The request token can to be obtained after completion of login process. Check out https://kite.trade/docs/connect/v1/#login-flow for more information. A request token is valid for only a couple of minutes and can be used only once. An access token is valid for one whole day. Don't call this method for every app run. Once an access token is received it should be stored in preferences or database for further usage. */ So we can't use this method, because for every time app re-opens we need new session, hence new login, which is not recommended. If we don't , does below code opens and keep any IO connection or it just keeps connection information which will be used when we do a API call.