Closed shankaranand007 closed 7 years ago
First, you should probably move lines 7 and the following (starting with the line // instance
) from after the if
/else
to inside the else
, right? It does not really make sense to execute this when you already know that there is no internet connection, does it?
Second, you should not attempt to detect the connection status right after calling connect
. Instead, wait until you are notified in the onConnect
callback from MeteorCallback
.
ConnectionDetector conDet = new ConnectionDetector(getBaseContext()); if(!conDet.isConnectingtoInternet()){ Toast.makeText(this, "NO..internet connection", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(this, "Internet connected", Toast.LENGTH_SHORT).show(); } //instance meteor = new Meteor(MainActivity.this, "ws://ydapp.in:3000//websocket"); //callback meteor.addCallback(this);
This is my code i getting error from this i dont know