private void testMiBandConnectivity() { // Reset test result mMiBandTestPassed = false; // Get an instance of the Mi Band SDK final MiBand miBand = MiBand.getInstance(this); // Attempt to connect to it miBand.connect( new ActionCallback() { @Override public void onSuccess(Object data) { // Set passed boolean mMiBandTestPassed = true; } @Override public void onFail(int errorCode, String msg) { // Failed, log it Log.d(Logging.TAG, "Failed to connect to Mi Band: " + msg); } }); }