This article intents to clear out the confusion about Callback Configuration in AppBuilder. What is a stub? Which tick to enable? What does "Is used?" mean? All these questions will be answered.
In a nutshell: tick "Is used?" to enable the Callback. Use "Stub?" to auto-generate the declaration of the Callback. Don't use "Stub?" in an existing project (generation will try to overwrite the flex-callbacks.c).
The Callback Configuration tab in the App Builder, shown on the picture above, can be a little bit confusing for the first time. Even if you got through what Callbacks are (basically built-in events for the Connect networking stack) and how to use them, this config screen with the "Stub?", "Is used?" columns can be challenging. First of all, it's good to know this tab changes several important files in the project, like the bookkeeping and the flex-callback-stubs.c, etc., but all in according to the settings we provide here. In a Connect based application, our code will be written in the flex-callbacks.c, while the flex-callback-stubs.c file collects all the callback functions that we don't use. The App Builder can pre-write the "stub", the declaration of the used callbacks in the flex-callbacks.c if you need it, but as it cannot append the source file, it will try to overwrite everything in it with blank functions. So here's a good rule-of-thumb on the usage of the checkboxes:
The flex-callbacks source file is not even generated yet. It's a good starting point to generate the empty functions. When turning on a Callback under the "Is used?" column, the App Builder automatically turns on the "Stub?" as well. It's recommended to leave it like this.
Whenever your flex-callbacks source file already exists, there's no option to generate the stub of the newly selected callbacks. If you would do that, it would overwrite the whole source file with the empty stubs, deleting all your work so far. Therefore, if you are just adding a new callback to an existing project, tick the appropriate box under the "Is used?" column and remove the tick from the "Stub?" column. This way the App Builder will update the flex-callback-stubs file, as it is necessary to remove the pre-written stub's second instance, but will not touch the flex-callbacks at all. It's important to note that this way you have to write the callback declaration yourself at least, in order your code to compile. You can also just copy the declaration from the App Builder on the right.
It's almost obvious, but worth to mention here: if you don't need a callback anymore, just untick the checkbox in the "Is used?" column next to its name. This will entirely disable the callback, adding it to the callback-stubs file and it will also try to remove it from the callbacks file. Naturally, you shouldn't let it do the latter, as it will result an empty callbacks file again, but everything else than the flex-callbacks.c can be updated.