In general, you can't. Have a search: search "cheat" on gamedev.stackexchange. This is not a language or runtime limitation. It is simply that the server is not in control of the client software, the user is.
Whatever happens on the client side software can either be imitated by another application, or the malicious users reverse engineer your app and make a modified version that submits whatever value they want.
The only real solution is to handle game state on the server.
No, I'm not saying that I can't figure out a way to safely submit the score. I'm saying that as long as submitting the score is possible, there is a way to cheat it. And this is not because of me not being able to figure out hot to prevent it.
If you want to make sure it is not possible to cheat, you should not submit scores. Instead, you should send what the user does in the game to the server, and have the server compute the score. And even then, that alone does not rule out bots.
However, you can still improve the security of the app... I mean, deter attackers from messing with it. These measures come to mind:
- Session tokens for the users (another app could authenticate with the right credentials)
- Single use tokens to submit score (could be intercepted)
- A digital signature on the app, checked client side (check can be faked)
- Code obfuscation (can be worked around)
As I said, they deter the attacker, make it somewhat harder for them. Yet, not impossible.
See also Sending a client-side high-score to a server securely at security.stackexchange (the comments in the question and answers there are also worth reading).