Fixed issues with Bluetooth

Added a flushing to the stream after writing the device name to speed up
the registration.
Moved the handler in MainActivity and made it private class.
The SensorController will only be created if a connection has been
established.