Repository navigation
Description
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.
Activity
Emill commentedon Sep 23, 2017
What does the lib print in logcat, while the completeGrabButton runs? Or could you debug-step through that function and see where it returns null?
xylo commentedon Sep 23, 2017
OK, indeed the FlicManager logs the message "completeGrabButton: proofs are not equal" and it returns null as FlicButton. What does that mean?
[-]Grabbing button fails with resultCode = -1[/-][+]Grabbing button fails: proofs are not equal[/+]Emill commentedon Sep 23, 2017
Hmm. Could you please post the full Intent extra datas for the request and the response and I can take a look at it on Monday?
xylo commentedon Sep 23, 2017
The intent extra data created by FlicMmanager.createIntentForInitiateGrabButton:
token:
The Intent extra data passed to onActivityResult:
The Intent extra data passed to FlicManager.completeGrabButton:
pubkey:
proof:
pubkey_signature:
Emill commentedon Sep 23, 2017
Yes please
xylo commentedon Sep 23, 2017
OK, I added the arrays in my previous post. Thanks for looking into this.
andrblum commentedon Feb 24, 2021
Hello, does someone found the cause/an explanation for this error?
andrblum commentedon Feb 25, 2021
I could resolve this problem by simply replacing the battery