Hardcoding an encryption key in an Android app is a bad idea - nothing new about that (see also https://medium.com/swlh/an-android-hacking-primer-3390fef4e6a0).
I found another article about encryption and a key generator which key is saved into Android Keystore (https://medium.com/@josiassena/using-the-android-keystore-system-to-store-sensitive-information-3a56175a454b) - seems like a good idea. But: I'd like to send any information (e-mail addresses, passwords, usernames and so forth) encrypted to my backend. So I use Encryption Between PHP & Java to encrypt the data that goes over the Internet from a phone to my backend.
The method (from the StackOverflow link) to encrypt uses a hardcoded encryption key, and I avoid that by using a key generator. But my backend needs to know that key, that is created by the frontend.
How do I send this key to the backend? Encrypted with another key, that is hardcoded in my app? It's an one-time only communication between the frontend (app) and the backend (php server). Or should send the key unencrypted to the backend? Or should I execute the key generator both at the frontend and the backend - with the risk that the keys aren't equal?
Hope to get some wise words on how to make the connection secure "enough".