Say, CORS for apps. Well, not the same thing, but...
Supposse I have uploaded an app to play store, and now I want my server to accept only connections from this app.
How can I do it?
What I would expect of the OS is is some process such as adding to my http request a couple of headers specifying the id of the app in the market, and signing the whole request with a signature in the android chain -or in the corresponding market CA certificate chain-. Then my server could verify that the request comes from the right app.
Plus, the OS could add some certified hardware info so if the app is run in an emulator I could deny service too.
Another way could be to include a "secret" in the app, of course, but it could always be reverse-engineered by decompilation, couldn't it? Or is there some keystore associated to the play store that could be used to provide this secret during https requests to the server?
A third way could be to use the azp field of an OAuth login, but again it could be compromised by decompilation, and moreover it forces the user to log in.
Use the Safety Net Attestation flow to request a secret token to the server.
After reading related questions, I think the trick is to use the Safety Net flow:
This is an speculative answer (I am the OP), please upvote it only if you are sure it is correct and a better alternative is not listed.