Most customers that want custom software written believe that they will own the software once it is finished. So, you have to be very clear while talking to them in the contract stage. The contract is everything. It has to be as detailed as possible, and state exactly what rights are being licensed to the customer and for what period of time.
As a rule, only large companies are going to demand all of the rights to the project. This is done mainly so that they control the source code in the future in case you disappear or they find someone cheaper to maintain it for them. If they had a string of Android programmers on staff, they probably wouldn't be asking you to quote a price on the project to begin with. With that said, it is very important that you discuss how the project is created and what language(s) are used. In my own experience, B4A is mostly unknown, so you do need to do some explaining if it is an exclusive rights contract.
Exclusive rights contracts also include a non-competition clause as a rule as well. That just states that you cannot create a competing product for an agreed upon amount of time (5 years is pretty common). It does not mean that you can no longer use any code related to that project. Only that you cannot create a competing product.
So, the contract is everything, and it needs to be agreed upon and in it's final state before you or anyone else sits down at a computer and writes the first line of code for the project. I very rarely do any outside work without a contract, just because it avoids any problems in the future over who gets what. When the client wants to make changes in the middle of the project, and they always do, this is called a change order. Each change order is written up as an amendment to the original contract and is CHARGED SEPARATELY for the additional work. It is also signed by all parties and attached to the contract.
Smaller companies or individuals soon get over the idea of owning the app once they get the licensing quote for exclusive rights. The licensing portion of the contract spells out who owns what and who is responsible for what over what period of time (if any). Most times, you are simply licensing the buyer to use your code in the manner agreed upon in the contract, and it is made clear that you (or your company) retains ownership of all intellectual property inside that project. It may or may not contain a non-competition clause as well. I don't offer it if they don't ask.
In most countries, without a contract, the software will be owned by the party paying to have it written (work for hire), or by your employer if it is done on company time or you are restricted by an employment contract. The contract explicitly spells out the rights and licensing of each party to avoid all of that mess. So I will say it again, the contract is everything.
I did not intend for this to turn into my next book, so please excuse the length.
--- Jem