How you recreate or restart the connection after losing it or disconnected from server or client?
I tried to call bt.stopService() and recall onStart();but it's crashing the application
bt.setBluetoothConnectionListener(new BluetoothSPP.BluetoothConnectionListener() {
public void onDeviceConnected(String named, String addresses) {
// Do something when successfully connected
}
public void onDeviceDisconnected() {
// Do something when connection was disconnected
try{
bt.stopService(); //stop service and kill all connection if I'm not mistaken
onStart(); // Call onStart to restart the service
}catch (Exception e){}
}
public void onDeviceConnectionFailed() {
// Do something when connection failed
try{
bt.stopService(); //stop service and kill all connection if I'm not mistaken
onStart(); // Call onStart to restart the service
}catch (Exception e){}
}
});
How you recreate or restart the connection after losing it or disconnected from server or client?
I tried to call
bt.stopService()
and recallonStart();
but it's crashing the application