Skip to content

Grabbing button fails: proofs are not equal #21

@xylo

Description

@xylo

I've written a small app using flic and it always worked fine with 2 buttons (white and green). After some months I bought a third button (black) and wanted to integrate it in my app, too. After some trouble activating the third button it finally worked, but for some reason flic seems to have a problem with my white button now, but only when I want to grab it from my app. In the flic app itself all buttons work perfectly.

My app code is based on the flic android tutorial project. I'm calling

FlicManager.getInstance(this, new FlicManagerInitializedCallback() {
	@OverrideButton grabbed
	public void onInitialized(FlicManager manager) {
		manager.initiateGrabButton(MainActivity.this);
	}
});

to grab the buttons and get the result via

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
	FlicManager.getInstance(this, new FlicManagerInitializedCallback() {
		@Override
		public void onInitialized(FlicManager manager) {
			FlicButton button = manager.completeGrabButton(requestCode, resultCode, data);
			if (button != null) {
				button.registerListenForBroadcast(FlicBroadcastReceiverFlags.UP_OR_DOWN | FlicBroadcastReceiverFlags.REMOVED);
				Toast.makeText(MainActivity.this, "Button grabbed", Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(MainActivity.this, "Could not grab the button " + resultCode, Toast.LENGTH_SHORT).show();
			}
		}
	});
}

In the flic app I don't see any differences between the 3 buttons. Only the colors and names are different. But they are all connected and all working in the flic app. Also when I call manager.initiateGrabButton(...) from my app I get to a view that shows me that all 3 buttons are conencted to the device. But now comes the strange thing. When I tap on the green or the black button they get successfully grabbed in my app, but when I tap on the white onActivityResult is called with a resultCode of -1 and manager.completeGrabButton returns null instead of a FlicButton.

I already removed the white button from my flic account and added it again but the behaviour is still the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions